Saroj Thapa Saroj Thapa - 1 year ago 63
CSS Question

Hover table rows but still keep background color of some cells

Some cells on my table have background colors. The table's row colors are alternating. I created a hover in table row. When the mouse is over a row, it hovers and all the background colors of some colorful cells are invisible. How can I hover but still keep the background colors of cells when the mouse pointer is over the row. My codes for hover and alternate colors:


tr:hover td,
tr.odd:hover {
background-color: #EBEBEB ;


$("tr:odd").css("background-color", "#dfe7f2");

Answer Source

You can do this in plain css.

tr:nth-child(odd) {
    background-color: #EBEBEB;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download