【发布时间】:2012-11-05 22:38:28
【问题描述】:
我有一个 PHP while 循环,它在表格中显示数据库的内容。 我想让表格中的所有行都变成不同的颜色。
但不仅仅是随机的。我希望它们有不同深浅的红色,第一行是最红的,然后其余的会变成浅红色。
作为一个例子,我想要和 iPhone App 一样的效果:清除。 图片示例:http://www.realmacsoftware.com/_resources/clear/images/ss_pinch.png
我尝试在 CSS 和一些 jQuery 中使用 -nth 来制作效果,但就是想不通。我希望你能试一试。
代码如下:
<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>
【问题讨论】:
-
你想要一个渐变。这与 PHP 无关。
-
你有什么想法,那我怎么做效果?
-
纯 CSS,渐变。见this answer
-
@Cthulhu 不会创建离散颜色
-
@JanDvorak
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.我认为这意味着渐变。
标签: php css colors html-table gradient