2009-02-11 68 views
21
<table border="1" width="100%" ID="Table2"> 
<tr> 
    <td>100</td> 
</tr> 
</table> 

該代碼仍然留在桌子兩側的「英寸」空間。嘗試讓表格跨越頁面的整個寬度。謝謝。html表跨越整個寬度?

回答

20

嘗試(在你的頭上<部分>,或現有的CSS定義)...

<style> 
    body { 
    margin:0; 
    padding:0; 
    } 
</style> 
5

您需要將表格的邊距設置爲0來拉伸整個寬度。或者,您也可以將表格的邊距設置爲負數。

13

您的表格可能存在邊緣樣式繼承。嘗試表的保證金設置爲0:

<table border="1" width="100%" ID="Table2" style="margin: 0px;"> 
<tr> 
    <td>100</td> 
</tr> 
</table> 
+0

此外,它可能是父元素的寬度或邊距,一直到正文/ – 2009-02-11 23:22:03

5
<table border="1"; width=100%> 

爲我工作。

0

僅供參考:

HTML應該是表&寬度:100%。 跨度應該是margin:auto;