I’ve got a simple table that I am laying out and I’ve come to a stumbling block. I’ve got a bunch of tabular data that all falls under one <th scope=“row” rowspan=“3”> and I’m adding a simple visual cue with some css that highlights the row when the user is hovering over it. The problem is, since the th spans multiple rows, the hover is only working on the first row in the group. Have I set this up incorrectly? I want the TH to be highlighted regardless of what row the user is hovering in the group. Here’s a sample of the HTML:
<tbody>
<tr>
<th scope="row" rowspan="3">iPhone</th>
<td>2G</td>
<td>3.0</td>
<td>Y</td>
<td>N</td>
<td>Y</td>
<td>Y</td>
<td>Y</td>
<td>Y</td>
<td>Y</td>
</tr>
<tr>
<td>3G</td>
<td>3.0</td>
<td>Y</td>
<td>N</td>
<td>Y</td>
<td>Y</td>
<td>Y</td>
<td>Y</td>
<td>Y</td>
</tr>
<tr>
<td>3GS</td>
<td>3.0</td>
<td>Y</td>
<td>N</td>
<td>Y</td>
<td>Y</td>
<td>Y</td>
<td>Y</td>
<td>Y</td>
</tr>
</tbody>
Here’s the simple hover effect I am using:
table tbody tr:hover, table tbody tr:hover th {
color: #000;
background-color: #E5E5D8;
}
How do I trigger the TH regardless of the row in the group? Is it possible without JS?