当前位置: 动力学知识库 > 问答 > 编程问答 >

php - How to change a color of table data in according to date

问题描述:

how can I change a color of a table data () in according to date ?

e.g i have a simple calendar which is created in and each day is in other table data () so if we have 24 january, the previous days in table data should have a background-color:red; and the next days including 24 january should have a background-color:grey;

It's possible to do it in php ?

网友答案:

Use date('j') to figure out current day number and in the for loop on 24. - 29. row you can compare day number to current day number and set <td style="background-color: ..."> to what you want. Or better attitude is to make two classes, .calendar-day-past and .calendar-day-future, and set the background-color property to them.

分享给朋友:
您可能感兴趣的文章:
随机阅读: