Conditional alternative table row styles in HTML5

Posted by Budda on Stack Overflow See other posts from Stack Overflow or by Budda
Published on 2010-12-31T01:48:06Z Indexed on 2010/12/31 1:53 UTC
Read the original article Hit count: 558

Filed under:
|
|
|

Is there any changes regarding this questions Conditional alternative table row styles since HTML5 came in?

Here is a copy of original question:

Is it possible to style alternate table rows without defining classes on alternate tags?

With the following table, can CSS define alternate row styles WITHOUT having to give the alternate rows the class "row1/row2"? row1 can be default, so row2 is the issue.

  <style>
  .altTable td { }
  .altTable .row2 td { background-color: #EEE; }
  </style>

  <table class="altTable">
   <thead><tr><td></td></tr></thead>
   <tbody>
    <tr><td></td></tr>
    <tr class="row2"><td></td></tr>
    <tr><td></td></tr>
    <tr class="row2"><td></td></tr>
   </tbody>
  </table>

Thanks a lot!

© Stack Overflow or respective owner

Related posts about html

Related posts about css