The HTML <article> tag describes the primary content in a web page. Generally, this tag includes content, such as blog posts, article posts, news, stories, etc.
What is HTML Article Tag?
The <article>
tag is one of the latest sectioning tags in HTML5. This tag defines articles in an HTML document. Multiple <article>
tags can be added to an HTML document where the inner element in a nested <article>
element defines an article corresponding to the outer element.
Syntax:
<article>Write your content here.</article>
Advantages of Using Article Tag
The <article>
tag usually includes the main content on a webpage or the snippet content of the main content. Users can consistently use a <div>
tag to specify the sections or divisions on a web page. But handling the <article>
tag is beneficial because when a web browser or web crawler accesses a web page and sees a section of content within the <article> tag, it will immediately understand that it is the main content. In this, the author information of an <article>
element can be provided using the <address>
element, but keep in mind that this may not apply to nested <article>
elements. Headers from <h2>
to <h6>
can be nested inside <article>
tags. If the user does not apply the <h1>
tag first, its placement is allowed.
How Does the Article Tag Work?
A single <article>
defines the primary content that is also unique. In contrast, a web page with multiple <article>
tags may include various contents, and in other ways, these elements are equivalent to <div>
tags. Here the primary purpose of the <article>
tag is to clean up the content by reducing the function of the <div>
tag in the HTML code.
The <article>
tag has special meaning for web browsers and search engines; Otherwise, It does nothing different. This <article>
tag can also be styled using CSS, similar to the <div>
tag.
Example:
An article with independent, self-contained content:
<!DOCTYPE html>
<html>
<head>
<title>Example of HTML article tag</title>
</head>
<body>
<article>This is the main content of this HTML document. And this content is contained within the article tag.</article>
</body>
</html>