The HTML <article> tag defines a self-contained, independent piece of content that can be reused or distributed separately.
- Used for content like blog posts, news articles, or forum posts.
- Represents independent and meaningful sections of a webpage.
- Improves semantic structure and readability of HTML.
- Can contain headings, paragraphs, images, and other elements.
<!--Driver Code Starts-->
<!DOCTYPE html>
<html>
<body>
<!--Driver Code Ends-->
<article>
<h3>My First Blog Post</h3>
<p>
This is a brief introduction to my blog.
I will share my thoughts on various topics.
</p>
</article>
<!--Driver Code Starts-->
</body>
</html>
<!--Driver Code Ends-->
The <article> tag is used to wrap independent content (single or multiple pieces), similar to <div>, but provides better semantic meaning and requires CSS for styling.
Default CSS setting
Most browsers will display the Article element with the following values.
article { display: block; }<!--Driver Code Starts-->
<!DOCTYPE html>
<html>
<body>
<!--Driver Code Ends-->
<article
style="
width: 300px;
border: 2px solid gray;
padding: 10px;
border-radius: 10px;
margin: 5px;
">
<img
src=
"https://media.geeksforgeeks.org/wp-content/cdn-uploads/20190710102234/download3.png"
alt=""
width="300"
height="250"
class="alignnone size-medium wp-image-560930" />
<h1>GeeksforGeeks</h1>
<p>
Sandeep Jain(FOUNDER) An IIT Roorkee alumnus and
founder of GeeksforGeeks. Apart from GeeksforGeeks,
he has worked with DE Shaw and Co. as a software
developer and JIIT Noida as an assistant professor.
</p>
</article>
<!--Driver Code Starts-->
</body>
</html>
<!--Driver Code Ends-->