<article>: The Article Contents element

<article> HTML 元素表示文档、页面、应用或站点中的独立组合,旨在可独立分发或可重用(例如,在联合组织中)。示例包括:论坛帖子、杂志或报纸文章、博客条目、产品卡、用户提交的评论、交互式小部件或小工具或任何其他独立的内容项。

¥The <article> HTML element represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication). Examples include: a forum post, a magazine or newspaper article, or a blog entry, a product card, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.

Try it

给定文档中可以包含多篇文章;例如,在一个博客上,当读者滚动时,一篇又一篇地显示每篇文章的文本,每篇文章将包含在 <article> 元素中,其中可能包含一个或多个 <section>

¥A given document can have multiple articles in it; for example, on a blog that shows the text of each article one after another as the reader scrolls, each post would be contained in an <article> element, possibly with one or more <section>s within.

属性

¥Attributes

该元素仅包含 全局属性

¥This element only includes the global attributes.

使用说明

¥Usage notes

  • 每个 <article> 都应该被识别,通常通过包含一个标题(<h1> - <h6> 元素)作为 <article> 元素的子元素。
  • <article> 元素嵌套时,内部元素表示与外部元素相关的文章。例如,博客文章的评论可以是嵌套在表示博客文章的 <article> 中的 <article> 元素。
  • <article> 元素的作者信息可以通过 <address> 元素提供,但不适用于嵌套的 <article> 元素。
  • 可以使用 <time> 元素的 datetime 属性来描述 <article> 元素的发布日期和时间。

示例

¥Examples

html
<article class="film_review">
  <h2>Jurassic Park</h2>
  <section class="main_review">
    <h3>Review</h3>
    <p>Dinos were great!</p>
  </section>
  <section class="user_reviews">
    <h3>User reviews</h3>
    <article class="user_review">
      <h4>Too scary!</h4>
      <p>Way too scary for me.</p>
      <footer>
        <p>
          Posted on
          <time datetime="2015-05-16 19:00">May 16</time>
          by Lisa.
        </p>
      </footer>
    </article>
    <article class="user_review">
      <h4>Love the dinos!</h4>
      <p>I agree, dinos are my favorite.</p>
      <footer>
        <p>
          Posted on
          <time datetime="2015-05-17 19:00">May 17</time>
          by Tom.
        </p>
      </footer>
    </article>
  </section>
  <footer>
    <p>
      Posted on
      <time datetime="2015-05-15 19:00">May 15</time>
      by Staff.
    </p>
  </footer>
</article>

结果

¥Result

技术总结

¥Technical summary

内容类别 流量内容, 分段内容, 可触知的内容
允许的内容 流量内容.
标签遗漏 无,开始和结束标记都是强制性的。
允许的父级 任何接受 流动内容 的元素。请注意, <article> 元素不得是 <address> 元素的后代。
隐式 ARIA 角色 article
允许的 ARIA 角色 application, document, feed, main, none, presentation, region
DOM 接口 HTMLElement

规范

Specification
HTML Standard
# the-article-element

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看

¥See also