Google Answers Logo
View Question
 
Q: CSS and Tables in HTML - rows with alternating colors ( No Answer,   0 Comments )
Question  
Subject: CSS and Tables in HTML - rows with alternating colors
Category: Computers > Programming
Asked by: hairymp-ga
List Price: $20.00
Posted: 09 Apr 2004 15:26 PDT
Expires: 10 Apr 2004 01:45 PDT
Question ID: 327866
I am making tables in html, se code snippet below.

These tables tend to be quite large, and to enhance readability I
have marked every second line in different background color. 

I now wan't to do this using CSS, but then of course I wan't
the CSS to decide how the lines should be marked (for
instance 3 rows white bg, 3 rows red, and so forth)

How do I do this?


-- snippet begin
<TABLE>
<thead>
<tr><th>Col1</th><th>Col2</th></tr>
</thead>
<tbody>
<tr bgcolor=red><TD>someinfo</TD><TD>other</TD></tr>
<tr bgcolor=blue><td>yeah</td><td>sure</td></tr>
<tr bgcolor=red><TD>w2k-sux</TD><TD>os/390 rules</TD></tr>
</tbody>
</table>
--snippet ends

Request for Question Clarification by hibiscus-ga on 10 Apr 2004 00:14 PDT
Hi Hairymp, 

There isn't any way to use pure CSS to do what you are asking, at
least not with CSS1 or CSS2.  It's possible with CSS3 though, and also
by using any of a number of dynamic methods via JavaScript, PHP, etc.

If you're interested I would be happy to provide you with information
about these methods, but unfortunately there is no way to do
alternating row colors with just CSS2.

Hibiscus
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy