<article>

Definition

The article element in HTML is used to represent a self-contained piece of content that can be independently distributed or reproduced. This could be a blog post, news article, or any other independent piece of content.

The article element enables you to properly structure and mark up this type of content in a way that is easy for both humans and machines to understand. By using the article element, you can make your content more easily discoverable and shareable, which can help improve its reach and impact.

To use the article element, you simply need to wrap the content that you want to represent as an independent piece of content within the article element.

It's important to note that the content within the article element should be relevant and meaningful on its own, without relying on other content on the page. In other words, the content within the article element should be able to stand on its own as an independent piece of content.

Examples

<article>
	<header>
		<h1>Article Title</h1>
		<p>By Author Name</p>
	</header>
	<p>
		Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec auctor, ipsum vel ultrices pellentesque, velit dui cursus velit, eu eleifend eros orci quis felis. 
	</p>
	<h2>Subheading</h2>
	<p>
		Maecenas ornare est in tincidunt molestie. Suspendisse potenti. Proin quis sapien auctor, varius purus at, vulputate massa.
	</p>
	<h2>Another Subheading</h2>
	<p>
		Ut volutpat, sem in pulvinar tincidunt, velit ipsum iaculis risus, in posuere purus nisl vel felis.
	</p>
	<footer>
		<p>
			This is the footer of the article, which could include information such as the author's bio or related links.
		</p>
	</footer>
</article>

Attributes

This element makes use of the global attributes.

Best Practices

Some best practices for using the article element include:

  • Use the article element to mark up content that is self-contained and can be distributed or reproduced independently.
  • Make sure the content within the article element is relevant and meaningful on its own, without relying on other content on the page.
  • Use subheadings (h1-h6 elements) to break up the content within the article into sections and subsections.
  • Use the header and footer elements to mark up the header and footer of the article, respectively.
  • Use the time element to mark up the publication or update date of the article.

The key is to use the article element to mark up self-contained content that can be independently distributed or reproduced, and to use other HTML elements to properly structure the content within the article.

Accessibility Considerations

There are a few accessibility considerations to keep in mind when using the article element. These include:

  • Make sure the content within the article element is relevant and meaningful on its own, without relying on other content on the page. This will help ensure that users with disabilities are able to understand and access the content of your article, even if they are using assistive technology such as a screen reader.
  • Use descriptive and informative alt text for images within the article element. This will help users with visual impairments understand the content of your images.
  • Use clear and descriptive headings and subheadings within the article element. This will help users with disabilities navigate and understand the structure of your content.
  • Use proper formatting and styling to make your content easy to read and understand. For example, use proper heading levels, paragraphs, lists, and other HTML elements to structure your content, and use CSS to control the font size, color, and other styling aspects of your content.

Overall, the key is to make sure your article element is properly structured, formatted, and styled, and that you are using other HTML elements, such as img and h1-h6, in a way that is accessible to users with disabilities. This will help ensure that your content is as accessible and understandable as possible for all users.

Browser Compatibility

ChromeFirefoxSafariInternet ExplorerMicrosoft EdgeOpera
YesYesYesYesYesYes