css源码:
.class1{
position:absolute;
width: 500px;
height: 400px;
top:50%;left:50%;/*显示开始位置是屏幕的中心点*/
margin-top:-200px; /*通过将上边距,向上调整负值,让DIV纵向居中。负值的绝对值应当是height的1/2*/
margin-left:-250px;/*通过将左边距,向左调整负值,让DIV横向居中。负值的绝对值应当是width的1/2*/
margin-right:0px;
margin-bottom:0px;
}
扫描二维码关注公众号,回复:
8666200 查看本文章