My table is created using a struts2 iterator and has variable length and content. It looks something like this:
<table>
<tr class="odd" machineId="1" parameterId="1"><td></td></tr>
<tr class="even" machineId="1" parameterId="2"><td></td></tr>
<tr class="odd" machineId="1" parameterId="3"><td></td></tr>
<tr class="odd" machineId="2" parameterId="4"><td></td></tr>
<tr class="even" machineId="2" parameterId="5"><td></td></tr>
<tr class="odd" machineId="3" parameterId="10"><td></td></tr>
<tr class="noParameters" machineId="4"><td></td></tr>
<tr class="odd" machineId="6" parameterId="8"><td></td></tr>
<tr class="odd" machineId="7" parameterId="9"><td></td></tr>
</table>
What I need is the following:
- Rows should change color when hovered over.
- Rows with the same machineId as the hovered row should have a different color.
- All other rows should maintain their default color.
I am looking to achieve this using only CSS, without relying on SASS. The solution should be compatible with major browsers including IE11 (and preferably IE9).
The current implementation of the page uses Javascript with Dojo 1.3 to add custom classes on hover, but I want to explore a CSS-only solution first. If necessary, I can update the code to use Dojo 1.9 as a fallback option.
Is it possible to achieve this desired behavior purely with CSS?