<body>
<div style ="text-align:center ">
.....</div>
</body>可实现网页居中 

解决方案 »

  1.   

    /*页面层容器 */
    #Pagecontainer
    {
    width: 100%; 
    height: 100%; 
    margin: 0 auto;
    text-align: left; 
    }
    /*页面层容器 */
    #container
    {
    width: 960px; 
    height: 100%; 
    margin: 0px auto;
    text-align: left;
    background-color: #FFF;
    padding: 0px;
    }<div id="Pagecontainer">
    <div id="container">XX</div>
    </div>
      

  2.   

    div根据不同分辨率垂直水平居中
    css:
        <style type="text/css">
            .center
            {
                position: absolute;
                width: 300px;
                height: 60px;
                left: 50%;
                top: 50%;
                z-index: 1;
                background-color: #0000ff;
                color: #ff0000;
                margin-left: -150px;
                margin-top: -32px;
            }
        </style>
    html
    <div class="center">
      垂直水平永远居中,唯一瑕疵是会移除浏览器外
    </div>