The section tag or <section> tag in HTML is used to define a section for a webpage.
So far we have used <div> tags to represent sections in HTML. However, with Semantic tags, we got the section tag that defines a section for a webpage. The Section Tag usually has a heading and a paragraph.
The section tag usually contains introduction for a webpage, details about chapters for a webpage e.t.c.
Let us understand section tag with the below example.
<html> <body> <section> <h1>First Paragraph</h1> <p>This is the first paragraph</p> </section> </body> </html>
So, if you look at the above code. The section tag represents a section in the HTML page.
<section> <h1>First Paragraph</h1> <p>This is the first paragraph</p> </section>
Now, the section tag is not just restricted to one section tag in a webpage. In simple words we can have multiple section tags in an HTML file.
<html> <body> <section> <h1>First Paragraph</h1> <p>This is the first paragraph</p> </section> <section> <h1>Second Paragraph</h1> <p>This is the second paragraph</p> </section> </body> </html>
So, if you look the above code, we have two section tags in the HTML page.
<section> <h1>First Paragraph</h1> <p>This is the first paragraph</p> </section> <section> <h1>Second Paragraph</h1> <p>This is the second paragraph</p> </section>