2011-05-17 63 views
5

父表中居中对齐的HTML子表我有以下的HTML表格格式:如何通过CSS

<table style="width: 100%;"> 
<tr> 
    <td> 
    //How to center this table within the parent-table cell? 
    <table style="width: 760px;"> 
    <tr> 
    <td> 
    </td> 
    </tr> 
    </table> 
    </td> 
</tr> 
</table> 

由于HTML5不支持表中的“ALIGN =中心”,我试图找出如何在上面的示例中模拟CSS中的'align = center'子表。

我已经尝试messin周围的CSS边距属性无济于事。

如何在上例中的子表中居中?

回答

4
<table style="width: 100%;"> 
<tr> 
    <td> 
    <table style="width: 760px; margin: auto;"> 
    <tr> 
     <td> 
     ss 
     </td> 
    </tr> 
    </table> 
    </td> 
    </tr> 
</table> 
工作