svg+js实现一个简洁的弹出提示框提示层Lotsa效果代码
代码语言:html
所属分类:弹出层
代码描述:svg+js实现一个简洁的弹出提示框提示层Lotsa效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap'>
<style>
* {
border: 0;
box-sizing: border-box;
margin: 0;
padding: 0;
}
:root {
--hue: 223;
--bg: hsl(var(--hue),10%,90%);
--fg: hsl(var(--hue),10%,10%);
--transDur: 0.15s;
font-size: calc(16px + (24 - 16) * (100vw - 320px) / (1280 - 320));
}
body,
button {
color: var(--fg);
font: 1em/1.5 "DM Sans", "Helvetica Neue", Helvetica, sans-serif;
}
body {
background-color: var(--bg);
height: 100vh;
display: grid;
place-items: center;
transition: background-color var(--transDur);
}
.notification {
padding-bottom: 0.75em;
position: fixed;
top: 1.5em;
right: 1.5em;
width: 18.75em;
max-width: calc(100% - 3em);
transition: transform 0.15s ease-out;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.notification__box,
.notification__content,
.notification__btns {
display: flex;
}
.notification__box,
.notification__content {
align-items: center;
}
.notification__box {
animation: flyIn 0.3s ease-out;
background-color: hsl(0,0%,100%);
border-radius: 0.75em;
box-shadow: 0 0.5em 1em hsla(var(--hue),10%,10%,0.1);
height: 4em;
transition:
background-color var(--transDur),
color var(--transDur);
}
.notification--out .notification__box {
animation: flyOut 0.3s ease-out forwards;
}
.notification__content {
padding: 0.375em 1em;
width: 100%;
height: 100%;
}
.notification__icon {
flex-shrink: 0;
margin-right: 0.75em;
width: 2em;
height: 2em;
}
.notification__icon-svg {
width: 100%;
height: auto;
}
.notification__text {
line-height: 1.333;
}
.notification__text-title {
font-size: 0.75em;
font-weight: bold;
}
.notification__text-subtitle {
font-size: 0.6em;
opacity: 0.75;
}
.notification__btns {
box-shadow: -1px 0 0 hsla(var(--hue),10%,10%,0.15);
flex-direction: column;
flex-shrink: 0;
min-wid.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0