mozilla
您的搜索结果

    time

    引进于 HTML5

    概述

     HTML time 标签(<time>) 定义公历的时间(24 小时制)或公历日期,时间和时区偏移是可选的。

    该元素能够以机器可读的方式对日期和时间进行编码,这样,举例说,用户代理能够把生日提醒或排定的事件添加到用户日程表中,搜索引擎也能够生成更智能的搜索结果.

    用法提示: This element is not appropriate for instances where a specific date cannot be calculated, nor should it be used for dates prior to the introduction to the Gregorian calendar (due to complications with calculating those dates).  如果给点的日期不是合法的格式,或者为公历日期之前的时间.那么该元素无法正常解析由于计算这些日期并发症.
    状态提示: 该元素仍在设计讨论中(http://blog.whatwg.org/weekly-time-data)

    使用环境

    Content categories flow content, phrasing content
    Permitted content Phrasing content, but no descendant time elements.
    Tag omission None, both the start tag and the end tag are mandatory.
    Permitted parent elements Any element that accepts phrasing content.
    Normative document HTML5, section 4.6.10

    属性

    像其他的所有元素一样,该元素可以使用 通用属性.

    datetime
    该属性表示此元素的时间和日期,并且属性值必须是一个 合法的日期格式. 如果属性值不能被解析成为一个正确的日期,该元素则不会有一个关联的时间戳.
    pubdate
    (该属性仍在被WHATWG 和 W3C组织设计和讨论中.) This Boolean attribute specifies that the date and time given by the element is the publication date of a document. The document it applies to is either the nearest ancestor article element or the document as a whole (if there is no ancestor article element). If true, the time element must have a corresponding date. Additionally, each time element indicating a publication date must be the only time element that does so for that document.

    DOM 接口

    该元素实现了 HTMLTimeElement 接口.

    例子

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

    上面的HTML会显示:

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

    pubdate 示例

    <article>
      <p>This article was created on <time pubdate>2011-01-28</time>.</p>
    </article>
    

    上面的HTML会显示:

    This article was created on <time pubdate>2011-01-28</time>.

    datetime 示例

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

    上面的HTML会显示:

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

    浏览器兼容性

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
    Basic support ? Not supported bug 629801 ? 11.50 ?
    Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
    Basic support ? Not supported ? ? ?

    文档标签和贡献者

    此页面的贡献者有: ziyunfei, hxl
    最后编辑者: hxl,