Hi, I'm Ahbab. In this article, I'll teach you about the semantic <article> element in HTML, why it's
important, and how to use it effectively in your web pages.
What is the <article> Element?
The <article> element is a semantic HTML5 tag used to represent a self-contained piece of
content that could be distributed and reused independently, such as a blog post, news story, forum post, or
user comment.
Why Use <article>?
Improves the structure and meaning of your HTML.
Helps search engines and assistive technologies understand your content.
Makes your code more readable and maintainable.
Example: Blog Post with <article>
<article>
<h2>My First Blog Post</h2>
<p>This is the content of my blog post.</p>
</article>
In this example, the entire blog post is wrapped in an <article> tag, making it clear
that this section is a standalone piece of content.
When Should You Use <article>?
Blog posts
News stories
Forum posts
User comments
Product cards or reviews
Practice: Try It Yourself
Project: Blog Home Page
Create a page with three different <article> elements, each representing a different
blog post. Give each post a title and a short paragraph.
Project: News Section
Build a news section for a website using <article> for each news item. Add a
headline, date, and summary for each.