unsider Posted January 19, 2008 Share Posted January 19, 2008 I'm not sure exactly what it is called, but here is an example of it.. http://ronpaulmarch.com/ scroll half way down and there is a list of 20 cities, with an alternating grey and white background. I'm curious how that is done, with both CSS or PHP, or both. I already have tables set up for comments on my own project and I'm looking alternate the background colors, for more appeal to the section. Thanks. Sorry if the question is inadequate. Wasn't sure how to ask Quote Link to comment https://forums.phpfreaks.com/topic/86808-alternating-table-backgrounds/ Share on other sites More sharing options...
bsamson Posted January 19, 2008 Share Posted January 19, 2008 Check out this site ... http://www.somacon.com/p338.php The best way I can think to do it is to create a loop ... Quote Link to comment https://forums.phpfreaks.com/topic/86808-alternating-table-backgrounds/#findComment-443683 Share on other sites More sharing options...
lalabored Posted January 19, 2008 Share Posted January 19, 2008 Make a variable for the table row background colour and every time your mysql database spits out another row, you set the colour to something else, for example... $colour = "dodgerblue"; //Sorry, too lazy to find the hex code... while($row = mysql_fetch_array($rs)){ echo "<tr><td bgcolor='$colour'>$row</td.</tr>"; if($colour == "dodgerblue"){ $colour = "skyblue"; //Don't know if that's a real colour xD }else{ $colour = "dodgerblue"; } } Quote Link to comment https://forums.phpfreaks.com/topic/86808-alternating-table-backgrounds/#findComment-443690 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.