怎么让table在页面上垂直居中显示呢??

解决方案 »

  1.   

    table的外层容器设置align="center"
      

  2.   

    如果css设置不行的话,还可以通过JS来设置margin-left margin-right
      

  3.   

    <TABLE width="100%" height="100%" align= "center" valign="middle">  
    </TABLE> 或者外面包一层DIV。
    让DIV居中。。
      

  4.   

    <TABLE width="100%" height="100%" align= "center" valign="middle">  
    </TABLE> 
      

  5.   


    <TABLE width="100%" height="100%" align= "center" valign="middle">   
    </TABLE>  
      

  6.   

    先放一个层 在页面中 table嵌套在层里面 把层 设置为 margin:0 auto;
      

  7.   

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>无标题页</title>
                <style type="text/css">
            html, body
            {
                height: 100%;
                overflow: auto;
            }
            body
            {
                padding: 0;
                margin: 0;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server"  style="height: 100%">
        <table border="0" cellpadding="0" cellspacing="0" width="100" style="height: 100%; width: 100%; ">
            <tr>
                <td align="center" valign="middle">
                    <table border="1" width="500px">
                        <tr>
                            <td>AAAAA</td>
                            <td>BBBBB</td>
                         </tr>
                        <tr>
                            <td>CCCCC</td>
                            <td >DDDDD</td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        </form>
    </body>
    </html>
      

  8.   

    table可以设置valign,div不可以