----- Original Message ----- From: "Ricky Zhou" <[EMAIL PROTECTED]>
To: "JJ" <[EMAIL PROTECTED]>
Cc: <css-d@lists.css-discuss.org>
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 PROTECTED]
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/

Reply via email to