Article (HTML element)

From Wiki @ Karl Jones dot com
Revision as of 09:57, 26 April 2016 by Karl Jones (Talk | contribs) (See also)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In HTML5, the article element represents "a section of content that forms an independent part of a document or site; for example, a magazine or newspaper article, or a blog entry."

Semantic element

article is a container for holding further content.

It has semantic meaning: "contents are article-related".

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 the time element is no longer a part of the W3C HTML 5 standard.

Example

<main>
  <h1>Introduction to web design (demonstration of article element)</h1>
  <p>This page demonstrates the article element, using the theme of web design.</p>

  <article>
    <h1>Text</h1>
    <p>Web design begins with text.</p>
  </article>

  <article>
    <h1>HTML</h1>
    <p>HTML is a markup language. It provides structure.</p>
  </article>

  <article>
    <h1>Cascading Style Sheets (CSS)</h1>
    <p>CSS is a style language. It provides look and feel.</p>
  </article>
</main>

Source: http://code.karljones.com/html/articles.html

See also

External links