颜色格式取决于它在html中的值

时间:2018-06-23 15:38:49

标签: html

<html>
<head>
<style>
table {
    border-collapse: collapse;
    width: 100%;
}

table, td, th {
    border: 1px solid black;
}
</style>
</head>
<body>

<p>Please update:</p>

<table>
  <tr>
    <th bgcolor="#bfff00">ID</th>
    <th bgcolor="#bfff00">S</th>
    <th bgcolor="#bfff00">R</th>
    <th bgcolor="#bfff00">D</th>
  </tr>

  <tr>
    <td>{hyper}</td>'
    <td>{r}</td>
    <td>{c[:-8]}</td>
    <td>{diff1}</td>
    </tr>
  </tr>
 </table>
 </body>
 </html>
t = (i["f"]["c"])
    dt = int(t[8:10])
    m = int(t[5:7])
    yr = int(t[0:4])
    Date = datetime.datetime.now().date()
    # print(Date)
    today = datetime.date.today()
    someday = datetime.date(yr, m, dt)
    diff = today - someday
    diff = str(diff.days)
    diff1=int(diff)

我实际上是从json文件中读取当前日期,而diff1将是当前日期与当前json文件日期之间的差额,因此,当差异大于4时,我需要突出显示diff。 如果值大于4,我想用红色打印diff1,我该怎么办?请帮助。我想知道如何在html中进行条件格式化

0 个答案:

没有答案