Previous Message
Next Message

Alternating row colors in table

Sent by JJ on 5 September 2005 18:06


----- Original Message ----- 
From: "Ricky Zhou" [EMAIL-REMOVED]>
To: "JJ" [EMAIL-REMOVED]>
Cc: [EMAIL-REMOVED]>
Sent: Monday, September 05, 2005 10:57 AM
Subject: Re: [css-d] Alternating row colors in table


>> I'd ideally like to apply the style to the <tr> tags rather than the
>> <td>
>> tags, but I'm not sure how to designate that in the css.  Is this
>> possible?
>
> Use
> tr.odd td {}
> amd
> tr.even td {}
>
> To select the td's that are children of the tr.
>
> <tr class="odd">
> <td>Text</td>
> <td>Text</td>
> </tr>
> <tr class="even">
> <td>Text</td>
> <td>Text</td>
> </tr>

Thank you.  That works well.  Is it safe to use the following to make the
row colors specific to tables of class="t3"?

table.t3 {
  border-collapse: collapse;
  }
..t3 td {
  background-color: #ffffff;
  padding: 3px 4px;
  border: 1px solid #e7e7d7;
  }
..t3 tr.1 td {
  background-color: #ffffff;
  }
..t3 tr.0 td {
  background-color: #dddddd;
  }

<table class="t3">
  <tr class="1">...</tr>
  <tr class="0">...</tr>
</table>

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: