<article>: The Article Contents element - HTML: HyperText Markup Language 编辑

The HTML <article> 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.

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

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.

Content categoriesFlow content, sectioning content, palpable content
Permitted contentFlow content.
Tag omissionNone, both the starting and ending tag are mandatory.
Permitted parentsAny element that accepts flow content. Note that an <article> element must not be a descendant of an <address> element.
Implicit ARIA rolearticle
Permitted ARIA rolesapplication, document, feed, main, none, presentation, region
DOM interfaceHTMLElement

Attributes

This element only includes the global attributes.

Usage notes

  • Each <article> should be identified, typically by including a heading (<h1>-<h6> element) as a child of the <article> element.
  • When an <article> element is nested, the inner element represents an article related to the outer element. For example, the comments of a blog post can be <article> elements nested in the <article> representing the blog post.
  • Author information of an <article> element can be provided through the <address> element, but it doesn't apply to nested <article> elements.
  • The publication date and time of an <article> element can be described using the datetime attribute of a <time> element. Note that the pubdate attribute of <time> is no longer a part of the W3C HTML5 standard.

Examples

<article class="film_review">
  <header>
    <h2>Jurassic Park</h2>
  </header>
  <section class="main_review">
    <p>Dinos were great!</p>
  </section>
  <section class="user_reviews">
    <article class="user_review">
      <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">
      <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>

Specifications

SpecificationStatusComment
HTML Living Standard
The definition of '<article>' in that specification.
Living Standard
HTML 5.1
The definition of '<article>' in that specification.
Recommendation
HTML5
The definition of '<article>' in that specification.
Recommendation

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:61 次

字数:9416

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文