I'm trying to setup a CSS style to highlight a table cell in a nested table when the table is hovered over.
See sample code below.....
<html>
<head>
<style type='text/css'>
table
{
border: solid 1px black;
}
table.Content:hover td.ContentIndent
{
background-color: #AAAAAA;
}
</style>
</head>
<body>
<table class="Content">
<tr>
<td class="ContentIndent">Root Indent, could be highlighted when this table is moused over</td>
<td>
<table class="Content">
<tr>
<td class="ContentIndent">Indent 1 - Should be highlighted only when this table is moused over</td>
<td>Content 1 - Indent 1 should be highlighted when this table is moused over</td>
</tr>
</table>
<table class="Content">
<tr>
<td class="ContentIndent">Indent 2 - Should be highlighted only when this table is moused over</td>
<td>Content 2 - Indent 2 should be highlighted when this table is moused over</td>
</tr>
</table>
</td>
<tr>
</table>
</body>
</html>
Basically when one of the child tables is moused over, I would like it's indentation cell to be highlighted. It would also be cool if the indentation cells of the parent cells would be highlighted.
Unfortunately, the way it's setup now, the indentation cells from both of the child cells get highlighted, regardless of which table is moused over. I've tried this in Firefox 3.5 and IE 8 and get the same results.
I did find this tutorial and associated demo that does basically what I'm trying to do, except it used nested lists instead of tables. But, when I try to use the > operator (to make the style table.Content:hover > td.ContentIndent
) it doesn't work at all. I'm not sure what the difference is.