2
有沒有辦法限制或限制HTML標籤中定義的樣式的「操作」字段。避免<colgroup>/<col> HTML標籤改變<thead>和<tfoot>行?
如下表:
<table>
<colgroup>
<col align="center" />
<col align="center" style="background-color: lightgrey;" />
<col align="center" />
</colgroup>
<thead>
<tr>
<th>Column A</th>
<th>Column B</th>
<th>Column C</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.a</td>
<td>1.b</td>
<td>1.c</td>
</tr>
<tr>
<td>2.a</td>
<td>2.b</td>
<td>2.c</td>
</tr>
</tbody>
</table>
我想background-color: lightgrey;
不被施加到 「列B」 小區(第二th
在thead
)。
我希望有一種方法來限制''但感謝您的回答。覆蓋'background-color' CSS指令的問題是,在''上將其設置爲'transparent'在最終的渲染中沒有區別,因爲''似乎就在''的下面。 – CDuv
':nth-type-type'確實是一個很好的實用解決方案(至少在我的情況下)。 – CDuv
您應該爲不規則標題使用colgroup。這是一個不規則的標題?你有一個3列的colgroup,然後每個tbody tr是3 td的。這是正常的。有關不規則標題的表格示例,請參閱:https://www.w3.org/WAI/tutorials/tables/irregular/。 –