css 是否能够解释 html 时间对象? 更具体:是否可以为包含过去日期的时间对象定义显示规则?
我的网站提供了一个乐队的演出列表。由于列表很长,将所有过去的表现“灰色化”会很有帮助。
这个应该是灰色的....
<time datetime="2018-09-08">
08.09.2018: Last night of the proms - Royal Albert Hall - Starttime: 20:00
</time>
这个还是……呃蓝色!
<time datetime="2018-12-31">
31.12.2018: The Blitz Party - Village Underground - Starttime: 22:00
</time>
最佳答案
检查一下。 JS Fiddle 预览 https://jsfiddle.net/itsselvam/8z5kja7w/
time{display:block; clear:both; margin:10px;}
time[datetime="2018-09-08"] {border:1px solid grey; color:grey; padding:4px; border-radius:4px}
time[datetime="2018-12-31"] {border:1px solid blue; color:blue; padding:4px; border-radius:4px}
<time datetime="2018-09-08">
08.09.2018: Last night of the proms - Royal Albert Hall - Starttime: 20:00
</time>
<time datetime="2018-12-31">
31.12.2018: The Blitz Party - Village Underground - Starttime: 22:00
</time>
关于css 解释 html 时间对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53650064/