- HTML Tutorial
- HTML - Home
- HTML - History and Evolution
- HTML - Overview
- HTML - Editors
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Headings
- HTML - Paragraphs
- HTML - Quotations
- HTML - Comments
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Style Sheet
- HTML - CSS Classes
- HTML - CSS IDs
- HTML - Images
- HTML - Image Map
- HTML Tables
- HTML - Tables
- HTML - Headers & Caption
- HTML - Table Styling
- HTML - Table Colgroup
- HTML - Nested Tables
- HTML Lists
- HTML - Lists
- HTML - Unordered Lists
- HTML - Ordered Lists
- HTML - Definition Lists
- HTML Links
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Iframes
- HTML - Blocks
- HTML Backgrounds
- HTML - Backgrounds
- HTML Colors
- HTML - Colors
- HTML - RGB
- HTML - HEX
- HTML - HSL
- HTML Forms
- HTML - Forms
- HTML - Form Attributes
- HTML - Form Control
- HTML - Input Attributes
- HTML Media
- HTML - Video Element
- HTML - Audio Element
- HTML - Embed Multimedia
- HTML Header
- HTML - Head Element
- HTML - Adding Favicon
- HTML - Javascript
- HTML Layouts
- HTML - Layouts
- HTML - Layout Elements
- HTML - Layout using CSS
- HTML - Responsiveness
- HTML - Symbols
- HTML - Emojis
- HTML - Style Guide
- HTML Graphics
- HTML - SVG
- HTML - Canvas
- HTML APIs
- HTML - Geolocation API
- HTML - Drag & Drop API
- HTML - Web Workers API
- HTML - WebSocket
- HTML - Web Storage
- HTML - Server Sent Events
- HTML Miscellaneous
- HTML - MathML
- HTML - Microdata
- HTML - IndexedDB
- HTML - Web Messaging
- HTML - Web CORS
- HTML - Web RTC
- HTML Demo
- HTML - Audio Player
- HTML - Video Player
- HTML - Web slide Desk
- HTML Tools
- HTML - Velocity Draw
- HTML - QR Code
- HTML - Modernizer
- HTML - Validation
- HTML - Color Code Builder
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
- HTML Resources
- HTML - Quick Guide
- HTML - Useful Resources
- HTML - Color Code Builder
- HTML - Online Editor
HTML - <article> Tag
The HTML <article> tag is used to represent an indepenedent, self-contained composition content in an HTML document.
When an HTML <article> element is nested, the inner element represents the article related to the outer element. For example, comments on social media posts can be an article element nested in the article representing the social media post.
It is mostly used for forum posts, magazine or newspaper articles, blog entries, product cards, etc.
A single HTML document can have multiple article elements.
Syntax
Following is the syntax of the <article> tag −
<article>.....</article>
Example
The following program shows the usage of the HTML <article> tag.
<!DOCTYPE html> <html lang="en"> <head> <title>HTML article tag</title> </head> <body> <!--create a article element--> <p>Example of the HTML 'article' element</p> <article> <h2>List of frontend technologies:-</h2> <ul> <li>HTML</li> <li>CSS</li> <li>JavaScript</li> <li>Angular</li> <li>React</li> <li>Bootstarp</li> </ul> </article> </body> </html>
When we run the above code, it will generate an output consisting of the text displayed on the webpage.
Example
Consider the following example, where we are going to use the <article> tag and applying the CSS properties.
<!DOCTYPE html> <html lang="en"> <head> <title>HTML article tag</title> <style> article { width: 300px; height: 150px; background-color: aquamarine; border-radius: 10px; } article h2, p { margin: 10px 10px; } </style> </head> <body> <!--create a article element--> <p>Example of the HTML 'article' element</p> <article> <h2>HTML</h2> <p>HTML stands for 'Hyper Text Markup Language'.</p> <h2>CSS</h2> <p>CSS stands for 'Cascading Style Sheet'.</p> </article> </body> </html>
On running the above code, the output window will pop up, consisting of the text along with a CSS applied to it is displayed on the webpage.
Example
Let's look into the another scenario, where we are going to create a nested article element.
<!DOCTYPE html> <html lang="en"> <head> <title>HTML article tag</title> <style> .demo { width: 250px; height: 270px; border-radius: 8px; background-color: aquamarine; margin: none; } article { background-color: aqua; width: 80%; margin: auto; border-radius: 10px; } article h2, p { margin: 10px 10px; } </style> </head> <body> <!--create a article element--> <p>Example of the HTML 'article' element</p> <article class="demo"> <h1>Frontend technologies:- </h1> <article> <h2>HTML</h2> <p>Hyper Text Markup Language</p> </article> <article> <h2>CSS</h2> <p>Cascading Style Sheet</p> </article> <article> <h2>JS</h2> <p>JavaScript</p> </article> </article> </body> </html>
When we run the above code, it will generate an output displaying the nested article text on the webpage.
Example
In the following example, we are creating nested ‘article’ elements to represent the self-contained content of the blog post and its comments using <article> tag.
<!DOCTYPE html> <html lang="en"> <head> <title>HTML article tag</title> <style> article img { width: 200px; } </style> </head> <body> <!--create a article element--> <article> <h2>Blog post</h2> <img src="https://www.tutorialspoint.com/static/images/logo.png?v3" alt=""> <article> <h2>Comments</h2> <p>Dman good...</p> <p>fabulous...!</p> </article> </article> </body> </html>
When we run the above code, it will generate an output displaying the text on the webpage.