In a table, upon hovering on one td cell, I want to highlight multiple td cells in the same row.
What I have currently is to use classes on each td like this:
<tr>
<td>v1_a</td>
<td class='c1'>v1_b1</td>
<td class='c1'>v1_b2</td>
<td class='c2'>v1_c1</td>
<td class='c2'>v1_c2</td>
</tr>
and have CSS like this:
tbody td.c1:hover,
tbody td.c1:hover ~ .c1,
tbody td.c2:hover,
tbody td.c2:hover ~ .c2 {
background-color: #CCffff;
}
then I can partially achieve what I want: JSFiddle
However, it is not exactly what I want. It highlights both col_b1 and col_b2 when I hover on col_b1, but not when I hover on col_b2. I want to highlight both of these columns whenever the pointer is on one of the cells.
Is there a simple solution ideally using only CSS?