//div 居中,背景为遮罩层
.model {
position: fixed;
top: 50%;
left: 50%;
width:300px;
height:300px;
background-color:#fff;
z-Index: 9999;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
//遮罩层
.zhe {
position: absolute;
left: 0px;
top: -3px;
background: rgba(0, 0, 0, .7);
width: 100%;
height: 100%;
filter: alpha(opacity=60);
z-index: 999;
}
//HTML
<div class="zhe " >
<div class="model " >
</div>
</div>
div 居中
最新推荐文章于 2023-07-12 20:22:21 发布