How to define a section in a document in HTML5 ?
In this article we will discuss how to define section in document in html5.we can create section in document using Section tag.
HTML <section> Tag: Section tag divide content into section and subsection. The section tag is used when there is requirement of two header, footer and other section of document.
Syntax:
<section> content </section>
Below is the code that illustrates the use of the section tag.
Example 1:
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:
HTML
<!DOCTYPE html> < html > < body > < h2 >GeeksforGeeks</ 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:
Please Login to comment...