实现div在整个页面中居中
<div id="cnblogs_post_body"><div id="bg"></div><style type="text/css">
#bg{width:200px;height:200px;top:50%;left:50%;position:absolute;margin-left:-100px;margin-top:-100px;}
</style>
解释:首先设置div的左上角在整个页面的50%处,然后再向上移动他宽度和高度的一半即可实现。
页:
[1]