I have a PHP while loop, which displays the content of a database, in a table.
I would like to make all the rows in the table different colors.
But not just random. I would like them have different shades of red, where the first row is most red, and then the rest fades into a lighter red.
As an exemple, I would like the same effect as the iPhone App: Clear.
Photo example: http://www.realmacsoftware.com/_resources/clear/images/ss_pinch.png
I’ve tried to make the effect with -nth in CSS and some jQuery, but just couldn’t figure it out. I hope you will give it a try.
Here is the code:
<table>
<tr>
<td align="center"><strong>Navn:</strong></td>
<td align="center"><strong>Spørgsmål:</strong></td>
<td align="center"><strong>Tid:</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><? echo $rows['name']; ?></td>
<td><? echo $rows['ask']; ?></td>
<td><? echo $rows['time']; ?></td>
<?php
}
?>
</tr>
</table>
If you need a different color for each element, then a static CSS file is not able to describe that. You could generate a CSS file on the fly, but I opt for inline styles instead. Don’t use inline styles if you can use a static CSS file.
For a simple linear interpolaction from red to white, adhering to your coding style. I’ve also removed an extra
</div>that didn’t belong there: