CSS实现水平/垂直自适应浏览器居中
关键样式: .bgbox {position:absolute;top:50%;left:50%;} .bgbox .ndiv{height:100px;width:200px;position: relative; margin:-50px auto auto -100px;} .ndiv的样式里margin的上边和左边边距,分别是这个容器高和宽的一半的负值
CSS实现水平/垂直自适应浏览器居中
关键样式: .bgbox {position:absolute;top:50%;left:50%;} .bgbox .ndiv{height:100px;width:200px;position: relative; margin:-50px auto auto -100px;} .ndiv的样式里margin的上边和左边边距,分别是这个容器高和宽的一半的负值