<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>hangge.com</title>
<style>
html, body, div, span, button {
margin: 0;
padding: 0;
border: 0;
}
button {
width: 120px;
height: 30px;
color: #FFFFFF;
font-family: "微软雅黑";
font-size: 14px;
background: #28B995;
}
#mask {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background: #000000;
opacity: 0.5;
display: none;
}
</style>
</head>
<body>
<button οnclick="document.getElementById('mask').style.display='inline'">点击显示遮罩</button>
<div id="mask" οnclick="document.getElementById('mask').style.display='none'"/></div>
</body>
</html>
遮罩层代码
最新推荐文章于 2021-06-01 10:02:39 发布