我有以下colgroup工作不正常。colgroup上的樣式不起作用
<colgroup class="" style="background-color:#FF0000;"></colgroup>
請參閱此jsfiddle。我在colgroup上的樣式不起作用。
我有以下colgroup工作不正常。colgroup上的樣式不起作用
<colgroup class="" style="background-color:#FF0000;"></colgroup>
請參閱此jsfiddle。我在colgroup上的樣式不起作用。
這裏是COLGROUP的例子:
<html> <body>
<table width="100%" border="1"> <colgroup style="background-color:#22FF22;"></colgroup> <colgroup style="background-color:#888888;"></colgroup> <colgroup style="background-color:#FF0000;"></colgroup>
<tr>
<th>A</th>
<th>B</th>
<th>C</th>
</tr>
<tr>
<td>D</td>
<td>E</td>
<td>F</td>
</tr>
<tr>
<td>G</td>
<td>H</td>
<td>I</td>
</tr>
</table>
</body> </html>
如果你的代碼是有點不一樣向我們展示更多的代碼來適當地repy ..
謝謝。請參閱我的評論 – user960567
,你可以colgroup
設置不會有大多數屬性一個效果,因爲通過定義,表格單元格繼承tr
元素(行)的屬性,而不是列或列組(繼承的程度)。
在CSS中直接在單元格元素上設置屬性。例如,要設置的前兩列的背景色中,假設只有td
標記被用於細胞,使用
td:first-child, td:first-child + td {
background: #f00;
color: #fff;
}
這意味着如果元素具有此樣式,則不可以使用colgroup樣式。謝謝 – user960567
我發現,TD也包含顏色。我覆蓋colgroup的顏色。 – user960567