CSS3: Stripe table with multiple <tbody> elements
Posted
by xyz
on Stack Overflow
See other posts from Stack Overflow
or by xyz
Published on 2010-05-30T23:35:03Z
Indexed on
2010/05/30
23:42 UTC
Read the original article
Hit count: 193
Hello,
I've got a table with multiple <tbody>
elements.
At a given time, only one <tbody>
is displayed, or all of them are displayed.
I currently use this CSS3
code to stripe the table.
table tr:nth-child(even) {
background: #efefef;
}
When a single <tbody>
element is shown, everything is (obviously) fine, but when multiple <tbody>
elements are shown the CSS rules apply to each one separately, and each <tbody>
has its own "stripes system". Together the stripes may or may not look consistent, depending on the number of rows.
<tbody>
<tr> [ODD]
<tr> [EVEN]
<tr> [ODD]
</tbody>
<tbody>
<tr> [ODD]
<tr> [EVEN]
</tbody>
...
Would I absolutely have to use JavaScript (...jQuery) to fix this?
© Stack Overflow or respective owner