W3docs

HTML <article> Tag

The <article> tag is used to define logical blocks on a page. W3docs HTML tutorial explains how to use the HTML <article> tag with syntax, examples.

The <article> tag is one of the HTML5 elements. It is used to define an independent, self-contained content. An article should have its own meaning and be easily differentiated from the rest of the web page content.

The <article> element can include:

  • blog entry
  • forum post
  • news
  • comment

In the case where the <article> element is nested, the internal element represents an article that is related to the external element.

You can provide the author information of the <article> element with the <address> element. It applies to each <article> independently, including nested ones.

Multiple <article> tags can be used in one HTML document.

You can use heading elements (<h1> to <h6>) inside the <article> tag to structure its content. Each <article> can start with its own <h1> heading.

The publication date and time of the <article> tag can be described using a <time> element with a datetime attribute.

Syntax

The <article> tag comes in pairs. The content is written between the opening (<article>) and closing (</article>) tags.

Example of the HTML <article> tag:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <article>
      <h1>Title of the article</h1>
      <p>Text of the article</p>
    </article>
  </body>
</html>

Result

article example

Example of the HTML <article> tag in the HTML <section> tag:

Article about flowers with the article tag|W3Docs

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <section>
      <h1>Articles about flowers</h1>
      <article>
        <h2>Roses</h2>
        <p>Rose – the queen of flowers - is the object of worship and ardent love. Since time immemorial, the rose has been the object of worship and admiration.</p>
      </article>
      <article>
        <h2>Lilies</h2>
        <p> Lily - an amazing beauty flower, one of the most ancient among a variety of bulbous plants. </p>
      </article>
    </section>
  </body>
</html>

Attributes

The <article> tag supports the Global Attributes and the Event Attributes.

How to style an HTML <article> Tag

article {
  border: 1px solid #ccc;
  padding: 10px;
  margin-bottom: 10px;
}

Practice

Practice

What is the functionality of the HTML <article> tag?