-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Zebra Tables
World Wide Web Server edited this page Jul 4, 2012
·
15 revisions
Zebra tables is a term used to describe tables that have alternating row colours:
[img]http://alistapart.com/d/stripedtables/itunes.png[/img]
This effect can be achieved using various methods, both server and client-side using PHP and CSS/Javascript.
[h3]Basic method[/h3]
[b]CSS[/b]
[code] .tr0 td{ background:#F4B624; color:#000; } .tr1 td{ background:#FFFFFF; color:#000; } [/code]
[b]View[/b]
[code] <?php $i = 0; foreach($result as $row){ ?>
<?php echo $row->name ?> ... <?php echo $row->descriptions ?><?php $i++; } ?> [/code]
[b]Output[/b]
[code]
Foo ... Bar ... [/code]