#MyTable tr+tr:hover {
background: #dfdfdf;
}
<table id="myTable">
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>X</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
<td>X</td>
</tr>
</table>
我设法将鼠标悬停在第 2 行和第 3 行,但将鼠标悬停在第 2 行和第 3 行时,如何跳过 td (X)。最好不要使用 jQuery 选择器。
Use the :not() https://developer.mozilla.org/En/CSS/%3anot, :第一个孩子 https://developer.mozilla.org/En/CSS/%3afirst-child and :最后一个孩子 https://developer.mozilla.org/En/CSS/%3alast-child.
#myTable tr:not(:first-child):hover td:not(:last-child) {
background: #dfdfdf;
}
另请参阅这个例子 http://jsfiddle.net/5PfGR/.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)