/ Published in: PHP
Expand |
Embed | Plain Text
<html> <head> <title>zebra table</title> <style type="text/css"> #mytable tbody tr.even td{ background-color: #d3ecf5; } #mytable tbody tr.odd td{ background-color: #fff; } </style> <body> <table id='mytable'> <tbody> <?php foreach($myData as $i=>$data): ?> <td> </td> </tr> <?php endforeach; ?> </tbody> </table> </body> </html>
Comments
Subscribe to comments
You need to login to post a comment.

you can also just do
echo ($i % 2) ? 'even' : 'odd';