2013-08-19 29 views

回答

8

那麼,使用border-collapse: collapse; CSS規則(其效果相同:表格單元格之間沒有空格)。請注意,這可能不適用於IE 5或6之類的舊版瀏覽器,因此如果您需要支持它們,那麼您運氣不佳。

<table class="table" style="clear: both; border-collapse: collapse; width: 100%;"> 
4

widthcellspacing屬性確實貶值作爲HTML5的。處理這個問題的正確方法是使用CSS。

對於CELLSPACING,請參閱這樣的回答:In HTML5, with respect to tables, what replaces cellpadding, cellspacing, valign, and align?

我從上面的鏈接答案中摘錄的代碼(歸功於@Drudge):

這是CELLSPACING =「5爲例「

.table { 
    border-collapse:separate; 
    border-spacing: 5px; 
} 

這是CELLSPACING =一個例子」 0"

.table { 
    border-collapse:collapse; 
    border-spacing: 0; 
} 

要解決你的width屬性無效,只需使用CSS width屬性:

.table { 
    width:100%; 
} 
相關問題