2
對於我創建的網站,我需要嵌套HTML表格。我有造型的,我不希望被應用於內表的第一行,所以我嘗試使用子組合子,像這樣的第一外表行(頭):CSS子組合器(>)不起作用
table.outside > tr:first-child {
# Outside table header row styles
}
然而,風格不要應用到外部表格的標題行,但是當我刪除它的子組合器時,它可以工作。
這裏是我的HTML:
<table class="outside">
<tr><!-- This should be styled -->
<th>Column 1</th>
<th>Column 2</th>
</tr>
<tr>
<td>
<table>
<tr><!-- Table Data --></tr><!-- This should not be styled -->
<tr><!-- Table Data --></tr>
</table>
</td>
</tr>
<!-- Etc. -->
</table>
我在做什麼錯?
瀏覽器通常會添加一個'
'標籤,如果你不這樣做的話。試試'table.outside> tbody> tr:first-child' –回答
你可以試試這個選擇器
table.outside > tbody > tr:first-child
但是如果你分享你的代碼,我的幫助會更好。來源
2014-02-27 21:28:28 amatellanes
代碼共享,對不起 – 1000000000
已確認:http://jsfiddle.net/QnzkG/5/ –
相關問題