tr:hover not working [英] tr:hover not working

查看:240
本文介绍了tr:hover not working的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当鼠标悬停在表格行上时,我试图突出显示(更改背景颜色)整行。我通过网络搜索,它应该是工作,但它不。我在Chrome上显示它。

 < table class =list1> 
< tr>
< td> 1< / td>< td> a< / td>
< / tr>
< tr>
< td> 2< / td>< td> b< / td>
< / tr>
< tr>
< td> 3< / td>< td> c< / td>
< / tr>
< / table>

我的css:

  .list1 tr:hover {
background-color:#fefefe;
}

正确的CSS应该是:

  .list1 tr:hover td {
background-color:#fefefe;
}

// - 这个css为td保持覆盖我之前显示的一个
.list1 td {
background-color:#ccc000;
}

感谢您的反馈!

  table.YourClass tr:class =h2_lin>解决方案

hover td {
background-color:#FEFEFE;
}

行不完全支持背景颜色, of:hover和child元素将产生您需要的结果。


I'm trying to highlight (change background color) of the entire row when the mouse is hovering on a table row. I searched through the Net and it should be working, but it doesn't. I'm displaying it on Chrome.

<table class="list1">
<tr>
   <td>1</td><td>a</td>
</tr>
<tr>
   <td>2</td><td>b</td>
</tr>
<tr>
   <td>3</td><td>c</td>
</tr>
</table>

my css:

.list1 tr:hover{
background-color:#fefefe;
}

The correct css should be:

.list1 tr:hover td{
background-color:#fefefe;
}

//--this css for the td keeps overriding the one i showed earlier
.list1 td{
background-color:#ccc000;
}

Thanks for the feedback guys!

解决方案

Your best bet is to use

table.YourClass tr:hover td {
background-color: #FEFEFE;
}

Rows aren't fully support for background color but cells are, using the combination of :hover and the child element will yield the results you need.

这篇关于tr:hover not working的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆