css+js实现右上角弹出提示通知消息效果代码

代码语言:html

所属分类:弹出层

代码描述:css+js实现右上角弹出提示通知消息效果代码

代码标签: css js 右上角 弹出 提示 通知 消息

下面为部分代码预览,完整代码请点击下载或在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">
<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:.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:.75em;
	position:fixed;
	top:1.5em;
	right:1.5em;
	width:18.75em;
	max-width:calc(100% - 3em);
	transition:transform .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 .3s ease-out;
	background-color:hsl(0,0%,100%);
	border-radius:.75em;
	box-shadow: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 .3s ease-out forwards
}
.notification__content {
	padding:.375em 1em;
	width:100%;
	height:100%
}
.notification__icon {
	flex-shrink:0;
	margin-right.........完整代码请登录后点击上方下载按钮下载查看

网友评论0