一种页面居中弹窗的CSS写法
.pop{
padding:8px 12px 12px 12px;
box-sizing:border-box;
position:fixed;
left:50%;
top:50%;
transform:translate(-50%,-50%);
width:400px;
max-width:99%;
background:#FFF;
box-shadow:0 4px 20px 0 rgba(0,0,0,0.4);
z-index:9;
}
Nyan Kusanagi 大佬写法:
.pop{
width:600px;
max-width:100%;
height:400px;
margin:auto;
position:fixed;
top:0;
right:0;
bottom:0;
left:0;
background:#999;
z-index:999;
display:flex;
align-items:center;
justify-content:center;
}
C
.pop{
padding:8px 12px 12px 12px;
box-sizing:border-box;
position:fixed;
left:50%;
top:50%;
transform:translate(-50%,-50%);
width:400px;
max-width:99%;
background:#FFF;
box-shadow:0 4px 20px 0 rgba(0,0,0,0.4);
z-index:9;
}
Nyan Kusanagi 大佬写法:
.pop{
width:600px;
max-width:100%;
height:400px;
margin:auto;
position:fixed;
top:0;
right:0;
bottom:0;
left:0;
background:#999;
z-index:999;
display:flex;
align-items:center;
justify-content:center;
}
C