Re: Alternate Colors in Rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux