用tr parent更改每个td的背景 [英] Change background for each td with tr parent
本文介绍了用tr parent更改每个td的背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 .GMDataRow td:hover
我想更改该tr元素中每个td的背景颜色。这是可能只有CSS?我只是尝试使用CSS,我不需要JQuery,JS解决方案。
On .GMDataRow td:hover
I want to change background-color for each td in that tr element. Is this possible only with CSS? I'm trying to do it with CSS only, I don't need JQuery, JS solutions.
<tr class="GMDataRow">
<td></td>
<td</td>
...
</tr>
推荐答案
Lalji建议的解决方案是完美的。
Solution suggested by Lalji is perfect.
tr.GMDataRow:hover td{
background-color:red;
}
- tr.GMDataRow查找类GMDataRow
- tr.GMDataRow:hover将为当前目标行激活悬停css。
- tr.GMDataRow:hover td将定位所有列它们是活动行的子级。
这篇关于用tr parent更改每个td的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文