I have a table that I currently do zebra striping on with the rows, even and odd which works fine. My problem is that I also have a class that is used to indicate the new rows which a different color style. It seems that this new class is being over thrown by the zebra stripe CSS, is there a way around this? Any tips or suggestions appreciated, thanks.
Here is a bit of CSS that controls this table
#table tbody tr:nth-child(odd){
background-color: #cccccc; color:black;
}
#table tbody tr:nth-child(even){
background: #EBEBEB; color: #7D7D7D;
}
#table tbody tr:nth-child(2n+1):hover{
cursor:pointer;
/* add gradient */
background-color: #808080;
background: -webkit-gradient(linear, left top, left bottom, from(#909090), to(#606060));
background: -moz-linear-gradient(top, #909090, #606060);
color: #dadada;
font-weight: ;
}
#table tbody tr:nth-child(2n):hover{
cursor:pointer;
/* add gradient */
background-color: #808080;
background: -webkit-gradient(linear, left top, left bottom, from(#909090), to(#606060));
background: -moz-linear-gradient(top, #909090, #606060);
color: #dadada;
}
.new {
background-color: #760086;
color:white;
}
If you put the CSS for the zebra-stripping rows before the codes for the newly created elements, then it should be just fine:
p:nth-child(2n+1){
/*blah*/
}
p:nth-child(2n){
/*blah*/
}
p.new{
/*blah*/
}
Live demo: http://jsfiddle.net/DerekL/ZFcKs/