I am trying to come up with a style my rows with odd/even styles. The row is going to be marked with class odd/even but the style needs to apply to the containing td/th.
The reason the style can't be placed directly on the row is because applying background colors to the row instead of the td/th causes inconsistent results in certain browsers.
When I apply the color to the td/th it causes problem in nested scenarios.
Nesting.even td, .even th {
background-color: #FBFCFD;
}
.odd td, .odd th {
background-color: #FEFFFF;
}
Test | Test | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Test | Test | ||||||||||||||||
Test | Test | ||||||||||||||||
Test |
|
What would be ideal is if I could do something like the following, but unfortunately it does work in older browsers.
.even > td, .even > th {
background-color: #FBFCFD;
}
.odd > td, .odd > th {
background-color: #FEFFFF;
}