I have a table, and I want to set some styling when you hover a row, so I used box-shadow
, and added the corresponding z-index to make this work. The problem is that when I set the td
s to have a background color, it just makes it be on top of the box-shadow, and therefore the hover does not work.
How can I fix this so that I can have both a background-color in the td
elements, and do the box-shadow style when hovering on a row?
I reproduced it in this simple jsfiddle: https://jsfiddle.net/pjz43a52/
Check that when you hover on a row, the box-shadow is behind the other rows. If you comment the line for the td
background-color, it just works:
table td {
/* background-color: #EFEFEF; */
z-index: 1;
}
Any ideas why would this happen?