【发布时间】:2014-06-08 08:59:57
【问题描述】:
我对 HTML5 <time> 语义标签感到困惑。在我看来,它用于标记诸如“今天”、“去年圣诞节”、“10.10.2010”、“2am”等字符串,以帮助机器识别和理解它们。我可以在 HTML5 Doctor 和 W3C 页面上找到的所有有效示例如下:
<p>I have a date on <time datetime="2008-02-14">Valentines day</time>.</p>
<p>We open at <time>10:00</time> every morning.</p>
但是如果我想设置文章发布日期(例如帮助 Google 机器人),但没有任何字符串显示呢?是否有效:
<article><time datetime="..."></time> content </article>
或:
<article><time datetime="..." /> content </article>
或者我应该以其他方式做到这一点?
(在我看来,<time datetime="...">...</time> 和 CSS display:none 用于 time 选择器……)
【问题讨论】:
-
你的意思是如果你在
<article />中包含了一个<time datetime="..." pubdate="pubdate"></time>空标签,那么datetime的值仍然会被用作那篇文章的发布日期? -
^ 请注意,
pubdate可能无效。我在规格中找不到它了(这在之前改变了几次)。 -
是的,
pubdate已被弃用。