Re: Alternate Colors in Rows
| From: | tedd | Date: | Thu, 04 Oct 2007 13:35:21 +0000 |
| Subject: | Re: Alternate Colors in Rows | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-262746@lists.php.net to get a copy of this message | ||
At 1:44 PM -0500 10/3/07, Steve Marquez wrote:
Greetings, I am attempting to alternate the colors of the container DIV. Anyone know how to do this?Hi Steve: Easy and simple. First, keep presentation separate from data. In other words, use css to define a css-class, like so: .row0 { background-color: yellow; } .row1 { background-color: #809FFF; } Second, embed php into your table, like so: <tr class="row<?php echo($i++ & 1 );?>"> You can see a working demo here: http://webbytedd.com/b/color-rows/ Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com