翻譯不完整。請協助 翻譯此英文文件。
HTML <time> element 用以表示時間,可以是24小時制時間或以公曆紀年的日期(日期可以添加時間和時區的資訊)
此 element 旨在以機器可讀的格式顯示時間。這能幫助使用者代理調度使用者的日期。
使用注意: 此 element 不適合用在「不確定正確時間」和「時間為西元前(日期的計算會出現錯誤)」的情況。
| 內容分類 | Flow content, phrasing content, palpable content. |
|---|---|
| 允許之內容 | Phrasing content. |
| 省略標籤 |
不可。 起始標籤和結束標籤是強制必要的 |
| 可接受的副 elements | 任何接受 phrasing content 的 element。 |
| DOM interface | HTMLTimeElement |
Attributes
和其他HTML elements一樣,接受所有 global attributes。
datetime- 此 attribute 用以表示日期或時間,其格式必須是有效的日期/時間格式。若其值不正確,則 element 就不會有關連的 time stamp.
示例
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 |
|---|---|---|
| WHATWG HTML Living Standard The definition of '<time>' in that specification. |
Living Standard | No change from HTML5.1 |
| HTML5.1 The definition of '<time>' in that specification. |
Working Draft | No change from HTML5 |
| HTML5 The definition of '<time>' in that specification. |
Recommendation | Initial definition. |
瀏覽器支援度
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | 33.0 | 22.0 (22.0) | 9.0 | 22.0 | 7.0 |
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | 2.1 | ? | 22.0 (22.0) | 10.0 | 11.50 Removed in 15.0 |
4.0-4.1 |
延伸閱讀
- The
<data>element, allowing to signal other kind of values.