joecooper Posted March 28, 2006 Share Posted March 28, 2006 I have a simple "while" loop that creates a table. but for appearance, i would like it to alternate in colours, as in 2 types of gray background or something. Quote Link to comment https://forums.phpfreaks.com/topic/6000-alternating-table-colours/ Share on other sites More sharing options...
Barand Posted March 28, 2006 Share Posted March 28, 2006 Check for odd/even row numbers[code]$count = 0;while (.....) { $bg = ($count++ % 2) ? '#EEEEEE' : '#CCCCCC'; echo "<TR style='background-color: $bg'>\n"; # cell data here echo "</TR>\n";}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/6000-alternating-table-colours/#findComment-21528 Share on other sites More sharing options...
litebearer Posted March 28, 2006 Share Posted March 28, 2006 Might look here...[a href=\"http://www.phpfreaks.com/tutorials/5/0.php\" target=\"_blank\"]http://www.phpfreaks.com/tutorials/5/0.php[/a]Lite..oops! too slow again. Quote Link to comment https://forums.phpfreaks.com/topic/6000-alternating-table-colours/#findComment-21529 Share on other sites More sharing options...
joecooper Posted March 28, 2006 Author Share Posted March 28, 2006 thanks! for the help, as im doing this whole project and have no time to test, i will let you know if it went well! thanks Quote Link to comment https://forums.phpfreaks.com/topic/6000-alternating-table-colours/#findComment-21530 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.