不确定屏幕大小的弹窗垂直居中(用了box方法)
对于父元素高度不确定,又要实现上下左右对齐,只需要在弹窗的父元素上使用box布局,控制弹窗上下左右居中
<div class="pop_wrap">
<div class="pop"></div>
</div>
.pop_wrap{
display:-webkit-box;
-webkit-box-align:center; /*上下对齐*/
-webkit-box-pack:center; /*左右对齐*/
width:100%;
height:100%;
background-color: yellowgreen;
}
.pop{
width:20rem;
height:20rem;
border:1px solid #e3e3e3;
border-radius: 1rem;
background-color: #f2f2f2;
}