设置容器的浮动方式为绝对定位
然后确定容器的宽高 比如宽500 高 300 的层
然后设置层的外边距
Div {
width:500px ;
height:300px;
margin: -150px 0 0 -250px;
position: absolute;
left:50%;
top:50%;
background-color: #000;
}
我的梦想:赚一个亿
设置容器的浮动方式为绝对定位
然后确定容器的宽高 比如宽500 高 300 的层
然后设置层的外边距
Div {
width:500px ;
height:300px;
margin: -150px 0 0 -250px;
position: absolute;
left:50%;
top:50%;
background-color: #000;
}