【发布时间】:2019-10-17 10:22:08
【问题描述】:
我有一个表格,显示使用 php 函数创建的一周中的 7 天。如何为表格中的每一天赋予不同的背景颜色。我是新手,任何和所有的帮助都会很棒。
<?php
for($prev_days = 0 ; $prev_days<7;$prev_days++) {
$curr_date = date('Y-m-d', strtotime(-$prev_days.' days'));
$dayOfWeek = date("l",strtotime(strval($curr_date)));
/*echo $dayOfWeek;*/
?>
<td title="click here to see the files">
<label>
<a onclick="document.getElementById('id01').style.display='block'" class="clr">
<?php echo substr(strval($dayOfWeek),0,3); ?>
</a>
</label>
</td>
<?php
}
?>
.CSSTableGenerator tr:first-child td{
background:-o-linear-gradient(bottom, #005fbf 5%, #003f7f 100%);
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #005fbf), color-stop(1, #003f7f) );
background:-moz-linear-gradient( center top, #005fbf 5%, #003f7f 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#005fbf", endColorstr="#003f7f"); background: -o-linear-gradient(top,#005fbf,003f7f);
background-color:#005fbf;
}
【问题讨论】:
-
仅使用 CSS 还是使用 PHP?