我已经尝试了大约 6 种不同的方法,但都无法让它发挥作用。
我试图在使用时将“div.content”水平居中在页面上position:absolute;
此方法适用于所有浏览器,但如果缩小页面大小,底部会出现滚动条:
HTML:
<div class="wrapper">
    <div class="header"></div>
    <div class="footer"></div>
    <div class="content">
        <div class="content2">CENTER THIS DIV</div>
    </div>
</div>
CSS:
div.header {
    background:url('http://i.istockimg.com/file_thumbview_approve/11670843/2/stock-illustration-11670843-seamless-wallpaper-background-tile.jpg') top center repeat-x;
    height:150px;        
}
div.footer {
    background:url('http://www.featurepics.com/FI/Thumb300/20081029/Blue-Tile-Background-947601.jpg') top left repeat-x;
    height:150px;        
}
div.content {
    position:absolute;
    top:20px;
    left:50%;
    height:250px;
    width:300px;        
}
div.content2 {
    position:relative;
    left:-50%;
    background:white;  
    height:250px;
}
</p>
</p>