totn HTML

HTML: <article> tag

This HTML tutorial explains how to use the HTML element called the <article> tag with syntax and examples.

Description

The HTML <article> tag is an HTML5 element that defines a self-contained composition in the HTML document. This tag is also commonly referred to as the <article> element.

Syntax

In HTML, the syntax for the <article> tag is:

<body>
<article>
  <h1>Heading for Article</h1>
  <p>Text that appears under article</p>
</article>
</body>

Attributes

Only the Global Attributes apply to the <article> tag. There are no attributes that are specific to the <article> tag.

Note

  • The HTML <article> element is an HTML5 element that is found within the <body> tag.
  • The <article> tag can be used for any of the following: forum post, blog entry, magazine article, newspaper article, user comment, or an independent content item.
  • For IE browsers older than IE 9, use HTML5shiv which is a javascript workaround to provide support for the new HTML5 elements such as: <header>, <main>, <article>, <section>, <aside>, <nav>, <footer>.

Browser Compatibility

The <article> tag has basic support with the following browsers:

  • Chrome 5+
  • Android 2.2+
  • Firefox 4.0+ (Gecko 2.0+)
  • Firefox Mobile 4.0+ (Gecko 2.0+)
  • Internet Explorer 9.0+ (IE 9.0+)
  • IE Phone 9.0+
  • Opera 11.10+
  • Opera Mobile 11.0+
  • Safari 4.1+ (WebKit)
  • Safari Mobile 5.0+ (iOs 4.2+)

Example

We will discuss the <article> tag below, exploring examples of how to use the <article> tag in HTML5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.