开发者

Is it correct to use the <time> tag for displaying dates in HTML5

Is it correct this code for displaying a date?开发者_Go百科

<time class="entry-date" datetime="2010-09-27T10:50:15+00:00" pubdate>27/09/2010</time>


Yup - that's correct. Have a look at this draft spec to see the valid date time strings: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#global-dates-and-times.

Your time represents 27th September 2010, 3:00pm UTC.


Yes, that is the one you should use according to:

http://www.w3schools.com/html5/html5_reference.asp

The tag defines a time or a date, or both.


Yes, it's both syntactically and semantically correct:

  • The time tag should be used to define a date and/or time
  • The syntax of the datetime attribute is correct and passes W3C:s HTML5 validator
  • The pubdate attribute is also fine, assuming that the time tag is inside an article tag and that the time tag actually specifies the publication time of the article
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜