How to define a section in a document in HTML5 ?
In this article, we will discuss how to define a section in a document in html5. We can create a section in the document using the Section tag.
HTML <section> Tag: Section tags divide content into section and subsection. The section tag is used when there is a requirement for two header, footer, and other sections of the document.
Syntax:
<section> content </section>
Example 1: Below is the code that illustrates the use of the section tag.
HTML
<!DOCTYPE html> < html > < body > < section > < h1 >GFG Section-1</ h1 > </ section > < section > < h1 >GFG Section-2</ h1 > < p > HTML5 HTML5</ p > </ section > < section > < h1 >GFG Section-3</ h1 > </ section > < section > < h1 >GFG Section-4</ h1 > < p >HTML5 HTML5</ p > </ section > </ body > </ html > |
Output:
Example 2:Below is the code that illustrates the use of the section tag.
HTML
<!DOCTYPE html> < html > < body > < h2 >w3wiki</ h2 > < section > < h2 >Geek 1</ h2 > < p > It is a Computer Science portal </ p > </ section > < section > < h2 >Geek 2</ h2 > < p > It is a Computer Science portal. </ p > </ section > </ body > </ html > |
Output: