Reputation: 1651
I am new to jquery. I have this in my code:
$("tbody tr:odd ").addClass("alt");
with css:
tbody tr.alt td {
background-color: #e6EEEE;
}
I have a cell in table with
<td class="coloron">
Right now, the every other row command is over riding my class="coloron".
How can I maintain my cell unique colour while having every other row colouring?
Upvotes: 0
Views: 1571
Reputation: 25445
try adding this in your CSS:
.coloron, .coloron.alt { background:red }
Upvotes: 0
Reputation: 13804
Your tbody tr.alt td
is more specific than .coloron
and will override it, instead do something like this:
tbody tr.alt td.coloron {
// your CSS
}
Or perhaps this:
tbody tr td.coloron {
// your CSS
}
Upvotes: 0
Reputation: 630429
Define the styles so that your unique color is defined later in the stylesheet, like this:
tbody tr.alt td {
background-color: #e6EEEE;
}
tbody tr td.coloron {
background-color: #FFFFFF;
}
If a row has multiple classes, given the same level of specificity in the style rule, the one defined last in the CSS wins. You can see it working here.
Upvotes: 2