The problem I am facing is similar to this post: HTML table how highlight row on hover except first column?. However the replies here are not the effect that I am looking for. I am looking for both the first 2 columns to light up when I hover over either one, and for the 3rd column to not light up anything at all when I hover over it.
2
Answers
If you need mouse events in the 3rd column this cannot be done without JS.
The problem that the 3rd column should be disabled. It could be done with
pointer-events:none
. But if we need mouse events in the 3rd columns here’s solution:You could use the
nth-child
CSS pseudo class and some Javascript:https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child
Please don’t use any javascript nor jquery for this, two css rule’s are enough.
Select all the
tr:hover
, and then exclude the last col by usingtd:not(:last-of-type)
.Then disable all
pointer-events
on the last column to disable that triggering the hover.