Reputation: 512
Is there any way in CSS the change the background-color of a Row in a table made of 3 columns, when I hover over a cell in this row?
table tr:hover
{
background-color:blue;
}
Doesn't seem to work.
UPDATE
I'm using Mozilla Firefox, it only works when I hover over a <th>
not a <td>
Upvotes: 1
Views: 4505
Reputation: 512
This is what solved it.
table tr:hover > td
{
background-color:aqua;
}
Upvotes: 1
Reputation: 2528
This works fine for me:
<html>
<head>
<style>
table tr:hover
{
background-color:blue;
}
</style>
</head>
<body>
<table>
<tr><td>Foo</td><td>Bar</td><td>FooBar</td></tr>
<tr><td>Bar</td><td>Foo</td><td>FooBar</td></tr>
</table>
</body>
</html>
What browser are you using?
Upvotes: 1
Reputation: 37533
Use this syntax:
tr.hover > td:hover
{
background-color: blue;
}
<tr class="hover">
<td>;lajsdfl;jasdl;jasd;f</td>
<td>;lajsdfl;jasdl;jasd;f</td>
</tr>
The fiddle: http://jsfiddle.net/DQ9Vz/
Upvotes: 1