Re: Alternate Colors in Rows
| From: | Nathan Nobbe | Date: | Wed, 03 Oct 2007 19:03:46 +0000 |
| Subject: | Re: Alternate Colors in Rows | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-262704@lists.php.net to get a copy of this message | ||
thats the key use mod 2 and check if the result is 1 or 0.
-nathan
On 10/3/07, Jon Anderson <jon@gamingsolutions.ca> wrote:
>
> Steve Marquez wrote:
> > I am attempting to alternate the colors of the container DIV. Anyone
> know
> > how to do this?
>
> I've used variants of this:
>
> <?php while ($condition): ?>
> <div style="background-color: #<?= ($i++%2) ? 'ffffff' :
> 'eeeeee'
> ?>;">
> <?php endwhile ?>
>
> jon
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>