2011-09-30 77 views
0
<table border="0" align="center"> 
<tbody> 
<tr> 
<td>Cell1</td> 
<td>Cell1</td> 
</tr> 
<tr> 
<td>Cell1</td> 
<td>Cell1</td> 
</tr> 
<tr> 
<td>Cell1</td> 
<td>Cell1</td> 
</tr> 
<tr> 
<td>Cell1</td> 
<td>Cell1</td> 
</tr> 
</tbody> 
</table> 

我不擅長編碼。我試過了,但無法弄清楚。你的幫助將不勝感激。如果你想風格的行內我似乎無法弄清楚如何居中對齊我的表格

<div style="width: 100%; text-align: center;"> 
    <!-- Your table here --> 
</div> 

回答

1
// CSS: 

#container { 
    text-align:center; // needed if you expect IE 5 
} 

.centered { 
    margin:0px auto; // this sets left/right margin to auto and 
        // centers the element 
} 


// HTML: 

<div id="container"> 
    <table class="centered" border="0"> 
     ... 
    </table> 
</div> 

或者:

+0

Yaaay!樣式內聯建議工作。謝謝丹尼斯! –

+0

不客氣。請不要猶豫,將其標記爲已回答。 –

+0

不適合我;( –

1

試試這個

<div style="text-align:center;"> 
    <table style="margin:0px auto;" border="0"> 
     ... 
    </table> 
</div> 
+0

謝謝,但沒有奏效。我正在使用wordpress。我輸入代碼並將表格居中在管理區域中。但是當我去到網站並刷新頁面時,表格仍然在頁面的左側。 –

+0

@JackStevens看起來像這將是一個有用的信息在你的問題。 –

+0

也謝謝你的幫助傑夫。丹尼斯式的內聯建議效果很好。謝謝。 Yaayay! –

相關問題