PHP - Tabelle mehrfarbig ausgeben
#FFDDDD |
#DDFFDD |
#DDDDFF |
#FFDDDD |
#DDFFDD |
#DDDDFF |
#FFDDDD |
<table>
<?php
// Tabelle mehrfarbig ausgeben
function bgColorRotate($n, $bgColors) {
return $bgColors[$n % sizeof($bgColors)];
}
$bgColors = array('#FFDDDD', '#DDFFDD', '#DDDDFF'); // usw.
for ($i = 0; $i < 7; $i++) {
echo '<tr style="background:' . bgColorRotate($i, $bgColors) .
'"><td>' . bgColorRotate($i, $bgColors) . '</td></tr>';
}
?>
</table>
Bausteine Alle Anzeigen
Eine zufällige Auswahl von Codeschnipseln
aus den Bereichen
HTML, CSS,
PHP, JavaScript und
MySQL.
<a> Verweis
CSS - Die Schriftgröße je nach Fensterbreite automatisch anpassen
PHP - Grafiken mit PHP rotieren