Html CSS不用于表TR中的TH hover
在Html CSS不用于表TR中的TH hover,html,css,Html,Css,在表中我将下面的CSS用于突出显示trs,我想使用:not用于th HTML: 将选择器的作用域设置为t正文,而不是thead tbody tr:hover { background-color:#fff; } tbody th:hover { background-color:none !important; } HTML: <table> <thead> <tr> <th>&l
表中
我将下面的CSS用于突出显示tr
s,我想使用:not
用于th
HTML:
将选择器的作用域设置为
t正文
,而不是thead
tbody tr:hover {
background-color:#fff;
}
tbody th:hover {
background-color:none !important;
}
HTML:
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
这仍然不起作用。所有列都需要用
包装。包括您在top@TilwinJoy有趣的是,如果没有实际的
,浏览器会将浮动的
视为附加的
,因此悬停选择器会触发。检查firebug/chrome dev中的输出。
tbody tr:hover {
background-color:#fff;
}
tbody th:hover {
background-color:none !important;
}
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>