Article Tag in HTML

The article tag in HTML5 is used to define independent content that can be used outside of the context of the main content. The article tag should have a self-contained meaning and can be used to define blog posts, news articles, forums, etc. Here is a step-by-step tutorial about the article tag in HTML5:

  1. Start with the basic HTML document structure, which includes the doctype declaration, head and body tags.
<!DOCTYPE html> 
<html> 
    <head> 
        <title>Example of Article Tag</title> 
    </head> 
    <body> 
    </body> 
</html> 
  1. To define an article, wrap the content with the article tag, like so:
<article> 
    <h2>Article Title</h2> 
    <p>This is an example of an article tag in HTML5. It can be used to define independent content, like blog posts or news articles.</p> 
</article> 
  1. Within the article tag, you can add other HTML elements, such as headings, paragraphs, images, etc. Here's an example of an article with additional content:
<article> 
    <h2>Article Title</h2> 
    <p>This is an example of an article tag in HTML5. It can be used to define independent content, like blog posts or news articles.</p> 
    <img src="image.jpg" alt="Article Image"> 
    <p>The article tag should have a self-contained meaning, and can be used to define blog posts, news articles, forums, etc.</p> 
</article> 
  1. The article tag also supports accessibility features like ARIA roles, allowing assistive technologies to recognize and understand the purpose of the content within the tag.
<article role="article"> 
    <h2>Article Title</h2> 
    <p>This is an example of an article tag in HTML5. It can be used to define independent content, like blog posts or news articles.</p> 
    <img src="image.jpg" alt="Article Image"> 
    <p>The article tag should have a self-contained meaning, and can be used to define blog posts, news articles, forums, etc.</p> 
</article> 
  1. You can have multiple article tags within the same HTML document. Here's an example of a page with two articles:
<article role="article"> 
    <h2>Article 1 Title</h2> 
    <p>This is the first article.</p> 
</article> 

<article role="article"> 
    <h2>Article 2 Title</h2> 
    <p>This is the second article.</p> 
</article> 

That's it! You now have a good understanding of how to use the article tag in HTML5 to define independent content.