改变在mouseover上的tr元素的背景颜色 [英] Changing background colour of tr element on mouseover
本文介绍了改变在mouseover上的tr元素的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想让我的表格行突出显示在鼠标上,但我还没有找到一种方法,这是不使用Javascript。这在CSS中不可能吗?
I want to have my table rows highlighted on mouse over, but I have yet to find a way to do it that isn't using Javascript. Is this not possible in CSS?
我试过这个:
tr:hover {
background: #000;
}
但这不行。使用 td:hover
可以工作,但我想更改整个表格行的背景颜色。
But that doesn't work. Using td:hover
works, but I want to change the background colour of the whole table row.
一个纯CSS / HTML的方式来做,或者我不得不诉诸于Javascript?
Is there a pure CSS/HTML way to do it, or am I going to have to resort to Javascript?
推荐答案
< tr>
本身很难用CSS访问,请尝试 tr:hover td {background:#000}
<tr>
s themselves are very hard to access with CSS, try tr:hover td {background:#000}
这篇关于改变在mouseover上的tr元素的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文