我正在使用Bootstrap为我的表格行设置悬停效果。但是,当选择表格行时,我想要移除悬停效果。我使用JavaScript设置一个类(select-row)来标记选中的行。但似乎对我不起作用。我在CSS中使用not子句。
我的CSS:
.table-hover > tbody > tr:not(.select-row):hover > td,
.table-hover > tbody > tr:not(.select-row):hover > th {
background-color: #f5fafe;
color: black;
}
tr.select-row {
background-color: #bddef9;
}
HTML:
<table class="table table-condensed table-hover">
<tr>
<td>xxx</td>
<td>xxx</td>
</tr>
</table>
tr
本身,而不是其中的td
。 - Leith