4.弹出层
首先准备HTML
<div class="testContent" style="height:3000px;">
<button id="login">show mask</button>
</div>
<div id="mask">
<div class="box">
<span class="close">x</span>
<h1>Hello Mask!</h1>
</div>
</div>准备CSS
#mask{
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: rgba(0,0,0,.7);
display: flex;
justify-content: center;
align-items: center;
transition: all ease-in-out 1s;
}
#mask .box{
width: 800px;
height: 400px;
background: #f9f9f9;
border: 1px solid #f7f7f7;
border-radius: 5px;
position: relative;
}
#mask .close{
position: absolute;
right: 20px;
top: 20px;
display: block;
width: 30px;
height: 30px;
line-height: 30px;
text-align: center;
cursor: pointer;
border-radius: 50%;
color: #ff7878;
border: 1px solid;
}
#mask .box h1{
text-align: center;
line-height: 400px;
margin: 0;
color: rgb(185, 185, 185);
font-size: 80px;
}Last updated