Skip to content

Instantly share code, notes, and snippets.

@lplume
Created December 3, 2010 14:04
Show Gist options
  • Save lplume/726986 to your computer and use it in GitHub Desktop.
Save lplume/726986 to your computer and use it in GitHub Desktop.
a way to alternate background HTML color in a dinamically generated list
<?php
$styler = true;
foreach($questions as $q) {
$color = ($styler) ? "#335533" : "#553355"; $styler = !$styler;
echo "<li style='background:$color;'>$q->text</li>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment