css+div实现渐变消息弹出提示层效果代码
代码语言:html
所属分类:弹出层
代码描述:css+div实现渐变消息弹出提示层效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url('https://fonts.googleapis.com/css2?family=Varela+Round&display=swap'); :root { --tr: all 0.5s ease 0s; --ch1: #2a4276; --ch2: #4591c4; --cs1: #388b3c; --cs2: #CDDC39; --cw1: #ff8f00; --cw2: #FFC107; --ce1: #931d31; --ce2: #ff5e42; } body { margin: 0; padding: 0; width: 100vw; height: 100vh; overflow: hidden; display: flex; align-items: center; justify-content: flex-end; flex-direction: column; background: radial-gradient(circle at 50% 100%, #1d1e23, #15141a); font-family: "Varela Round", sans-serif; } .toast-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; transition: var(--tr); position: absolute; padding: 0 1rem; height: 100%; } .toast-item { overflow: hidden; max-height: 25rem; transition: var(--tr); position: relative; animation: show-toast 4s ease 3s 1; } @keyframes show-toast { 0%, 50%, 100% { max-height: 0; opacity: 0; } 10%, 25% { max-height: 15rem; opacity: 1; } } .toast { color: #f5f5f5; padding: 1rem 2rem 1rem 4rem; border-radius: 1rem; position: relative; font-weight: 300; margin: 1rem 0; text-align: left; max-width: 16rem; transition: var(--tr); opacity: 1; background: linear-gradient(180deg, var(--clr), var(--bg)); } .toast:before { content: ""; position: absolute; width: calc(100% - 0.3rem); height: calc(100% - 0.3rem); top: 0.15rem; left: 0.15em; z-index: 0; border-radius: 0.85rem; background: linear-gradient(90deg, #1f2333, #22232b); } .toast:after { content: ""; position: absolute; width: 2rem; height: 2rem; background: linear-gradient(180deg, var(--clr), var(--bg)); top: 1.2rem; left: 1rem; border-radius: 3rem; padding-top: 0.2rem; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; box-sizing: border-box; font-weight: bold; color: #22232b; } .toast h3 { font-size: 1.35rem; margin: 0; line-height: 1.35rem; font-weight: 300; position: relative; } .toast p { position: relative; font-size: 0.95rem; z-index: 1; margin: 0.25rem 0 0; color: var(--clr); } .close { position: absolute; width: 1.35rem; height: 1.35rem; text-align: center; right: 1rem; cursor: pointer; border-radius: 100%; background: var(--clr); color: #22232b; } .close:after { position: absolute; font-family: 'Varela Round', san-serif; width: 100%; height: 100%; left: 0; font-size: 1.8rem; content: "+"; transform: rotate(45deg); border-radius: 100%; display: flex; align-items: center; justify-content: center; } .close:hover { background: var(--bg); color: #fff; } .toast-item.success { animation-delay: 2s; } .toast-item.warning { animation-delay: 1s; } .toast-item.error { animation-delay: 0s; } .toast.help:after, .icon-help:after { content: "?"; } .toast.success:after, .icon-success:after { content: "L"; font-size: 1.25rem; font-weight: bold; padding-bottom: 0.35rem; transform: rotateY(180deg) rotate(-38deg); text-indent: 0.1rem; } .toast.warning:after, .icon-warning:after { content: "!"; font-weight: bold; } .toast.error:after, .icon-error:after { content: "+"; font-size: 2rem; line-height: 1.2rem; transform: rotate(45deg); } .toast a { color: #fff; } .toast a:hover { color: var(--clr); } .toast-item.closed { max-height: 0; } /*** ICONS ***/ .toast-icons { --bg: #2c3041; --clr: #373b4b; background: linear-gradient(90deg, #1f2333, #22232b); padding: 1rem 1rem 1.25rem 1rem; display: flex; justify-content: space-around; border-radius: 1rem; gap: 1.5rem; width: 100%; box-sizing: border-box; margin-top: 1rem; margin-bottom: 1rem; position: relative; box-shadow: inset 0 0 0.........完整代码请登录后点击上方下载按钮下载查看
网友评论0