The <article> tag has been added to HTML5. It is used to define an independent, self-contained content. An article should have its own meaning and be easily differentiated from the rest of the web page content.
The <article> element can include:
- Blog entry
- Forum post
Multiple <article> tags can be used in one HTML document.
The content of the <article> tag is written between the opening (<article>) and the closing (</article>) tags.
Headers from <h2> to <h6> can be nested inside the <article> tag. If the <h1> tag was not used before, then its placement is allowed.
<html> <head> <title>Title of the document</title> </head> <body> <article> <h1>Title of the article</h1> <p>Text of the article</p> </article> </body> </html>
Let’s consider another example, where there are multiple <article> tags in a <section> element.
<html> <head> <title>Title of the document</title> </head> <body> <section> <h1>Articles about flowers</h1> <article> <h2>Roses</h2> <p>Rose – the queen of flowers - is the object of worship and ardent love. Since time immemorial, the rose has been the object of worship and admiration.</p> </article> <article> <h2>Lilies</h2> <p> Lily - an amazing beauty flower, one of the most ancient among a variety of bulbous plants. </p> </article> </section> </body> </html>