FacebookTwitterGoogle+Share

changing the background colour of a table’s cell that is nested three tables deep

This is for Dennis, because he couldn’t find it on the internet:

Mouse over the 1 to change its cell colour.

0
0
1
0

HTML


<table border="1">
<tr>
<td>0</td>
<td>
<table border="1">
<tr>
<td>0</td>
<td>
<table border="1">
<tr>
<td>1</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td>0</td>
</tr>
</table>

So basically just three tables nested.

CSS

td td td:hover { background-color: #aeaeae; }

td td td:hover means that when the mouse is over a td tag, that is a descendant (within) of a td tag that is a descendant of a td tag this style is active.

Comments