目录 搜索
Attributes accesskey (attribute) class (attribute) contenteditable (attribute) contextmenu (attribute) data-* (attribute) dir (attribute) draggable (attribute) dropzone (attribute) Global attributes hidden (attribute) id (attribute) itemid (attribute) itemprop (attribute) itemref (attribute) itemscope (attribute) itemtype (attribute) lang (attribute) slot (attribute) spellcheck (attribute) style (attribute) tabindex (attribute) title (attribute) translate (attribute) Elements a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 head header hr html i iframe img input input type="button" input type="checkbox" input type="color" input type="date" input type="datetime"-local input type="email" input type="file" input type="hidden" input type="image" input type="month" input type="number" input type="password" input type="radio" input type="range" input type="reset" input type="search" input type="submit" input type="tel" input type="text" input type="time" input type="url" input type="week" ins kbd label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param picture pre progress q rp rt rtc ruby s samp script section select slot small source span strong style sub summary sup table tbody td template textarea tfoot th thead time title tr track u ul var video wbr Miscellaneous Attributes Block-level elements CORS enabled image CORS settings attributes Element Inline elements Kinds of HTML content Link types Microdata Optimizing your pages for speculative parsing Preloading content Reference Supported media formats Using the application cache Obsolete acronym applet basefont big blink center command content dir element font frame frameset hgroup image input type="datetime" isindex keygen listing marquee nextid noframes plaintext strike tt xmp
文字

 HTML标签(<time>)表示是在24小时的时钟时间或在一个确切的日期公历(带有可选的时间和时区信息)。

内容类别

Flow content, phrasing content, palpable content.

允许的内容

Phrasing content.

标记遗漏

没有; 起始和结束标签都是强制性的。

允许的父母

任何接受  phrasing content. 的元素。

允许ARIA角色

任何

DOM接口

HTMLTimeElement

属性

像所有其他元素一样,此元素拥有可以使用通用属性。

datetime该属性表示此元素的时间和日期,并且属性值必须是一个有效的日期格式,并可包含时间。 如果此值不能被解析为日期,元素不会有一个关联的时间戳.

使用说明

此元素用于以机器可读格式显示日期和时间。例如,这可以帮助用户代理提供将事件添加到用户的日历。

该元素不适用于无法计算特定日期的情况,也不适用于引入公历之前的日期(由于计算这些日期的复杂性)。

例子

Simple example

HTML

<p>The concert starts at <time>20:00</time>.</p>

Output

datetime example

HTML

<p>The concert took place on <time
  datetime="2001-05-15T19:00">May 15</time>.</p>

Output

规范

Specification

Status

Comment

HTML Living StandardThe definition of '<time>' in that specification.

Living Standard

No change from HTML 5.1

HTML 5.1The definition of '<time>' in that specification.

Recommendation

No change from HTML5

HTML5The definition of '<time>' in that specification.

Recommendation

Initial definition.

浏览器兼容性

Feature

Chrome

Edge

Firefox

Internet Explorer

Opera

Safari

Basic Support

62

(Yes)

22

No

49 11.5 — 12

7

datetime

62

(Yes)

22

No

49 11.5 — 12

7

Feature

Android

Chrome for Android

Edge mobile

Firefox for Android

IE mobile

Opera Android

iOS Safari

Basic Support

62

62

(Yes)

22

No

49 11.5 — 12

4

datetime

62

62

(Yes)

22

No

49 11.5 — 12

4

上一篇: 下一篇: