Is there a priority order when referencing in CSS?
Here is my dilema: I want the table formatted every other row with different colors (even/odd)…
table.nx-skootable-data tbody tr:nth-child(odd) td { background-color: #FFFFF2;}
table.nx-skootable-data tbody tr:nth-child(even) td {
background-color: #FFFFFF;}
I want the row to highlight a third color when the user hovers over the row…
table.nx-skootable-data tbody tr:nth-child(even):hover td,
table.nx-skootable-data tbody tr:nth-child(odd):hover td {
background-color: lightsteelblue;
Finally, I want the table to have a 4th color when the row’s drawer is opened…
table.nx-skootable-data tbody tr.nx-item-has-drawer td { background-color: black;
color:white;
font-weight: bold;}
(BTW, any help in making the above CSS more efficient is most welcome!)
My confusion is over the order in which these options prioritize. I want the “has-drawer” reference to take top priority, but it seems like the “hover” reference has it. If a drawer is opened, I want the row to show that color, regardless of whether or not the user is hovering over it…
Question
CSS: Syntax priority
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
