我有一个包含三列的表格。当我将鼠标悬停在它上面时,我希望能够仅更改第三列的格式。
我希望能够结合
td:nth-child(3) {背景颜色:#ddd;}
和
td:hover {background-color: #ddd;}
我该怎么做?
最佳答案
我认为这就是您所追求的。
td:hover:nth-child(1) {background-color: #f5f5f5;}
td:hover:nth-child(2) {background-color: #ff0000;}
td:hover:nth-child(3) {background-color: #ddd;}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
干杯
关于CSS 将鼠标悬停在表格中时更改表格中特定单元格的背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44147206/