?
本文檔使用 php中文網(wǎng)手冊 發(fā)布
HTML標簽(<time>
)表示是在24小時的時鐘時間或在一個確切的日期公歷(帶有可選的時間和時區(qū)信息)。
內(nèi)容類別 | Flow content, phrasing content, palpable content. |
---|---|
允許的內(nèi)容 | Phrasing content. |
標記遺漏 | 沒有; 起始和結束標簽都是強制性的。 |
允許的父母 | 任何接受 phrasing content. 的元素。 |
允許ARIA角色 | 任何 |
DOM接口 | HTMLTimeElement |
像所有其他元素一樣,此元素擁有可以使用通用屬性。
datetime
該屬性表示此元素的時間和日期,并且屬性值必須是一個有效的日期格式,并可包含時間。 如果此值不能被解析為日期,元素不會有一個關聯(lián)的時間戳.
此元素用于以機器可讀格式顯示日期和時間。例如,這可以幫助用戶代理提供將事件添加到用戶的日歷。
該元素不適用于無法計算特定日期的情況,也不適用于引入公歷之前的日期(由于計算這些日期的復雜性)。
<p>The concert starts at <time>20:00</time>.</p>
datetime
example<p>The concert took place on <time datetime="2001-05-15T19:00">May 15</time>.</p>
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 |