X

Headline

This is an important message requiring you to make a choice if you're based in the EU.

HTML <article> Tag

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

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

Syntax

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

Headers from <h2> to <h6> can be nested inside the <article> tag. If the <h1> tag was not used before, then its placement is allowed.

Example

<!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

Let’s consider another example, where there are multiple <article> tags in a <section> element.

Example

<!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>

Result

Attributes

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

How to style <article> tag

Common properties to alter the visual weight/emphasis/size of text in <article> tag:?

  • CSS font-style property sets the style of the font. normal | italic | oblique | initial | inherit
  • CSS font-family property specifies a prioritized list of one or more font family names and/or generic family names for the selected element.
  • CSS font-size property sets the size of the font.
  • CSS font-weight property defines whether the font should be bold or thick. CSS text-transform Property controls text case and capitalization.
  • CSS text-decoration property specifies the decoration added to text, and is a shorthand property for text-decoration-line, text-decoration-color, text-decoration-style

Coloring text in <article> tag:

  • CSS color property describes the color of the text content and text decorations
  • CSS background-color property sets the background color of an element.

Text layout styles for <article> tag:

  • CSS text-indent property specifies the indentation of the first line in a text block.
  • CSS text-overflow property specifies how overflowed content that is not displayed should be signaled to the user.
  • CSS white-space property specifies how white-space inside an element is handled.
  • CSS word-break property specifies where the lines should be broken.

Other properties worth looking at for <article> tag


Browser support

6+ 4+ 5+ 11.1+


Do you find this helpful?

Related articles