HTML section Tag

The <section> tag is not a generic container in a web-page. The content inside <section> tag will be grouped i.e. it’ll connect to a single subject and appear as an entry in an outline of the page. A common rule is that the <section> element is valid only if that element’s contents would be listed explicitly in the document’s outline.

Section tag is used to distribute the content with a similar theme. The main advantage of the section tag is, it describes its meaning in a web page. It is mostly used when headers, footers, or any other section of documents are needed in a web page. Requires closing </section> tag too.

Syntax:   

<section>
<h1>Title</h1>
<p>Information goes here....</p>
</section>

Example:

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>Title of the document</title>
</head>
 
<body>
    <h1 style="color:green">
        w3wiki
    </h1>
    <section>
        <h2>w3wiki </h2>
        <ul>
            <li>Machine learning</li>
            <li>DSA</li>
            <li>Competitive programming</li>
            <li>Web-Development</li>
            <li>Java</li>
        </ul>
    </section>
    <section>
        <h3>Books</h3>
        <p>Learn Machine learning</p>
        <p>Learn DSA</p>
        <p>Learn Competitive programming</p>
        <p>Learn Web-Development</p>
        <p>Learn Java</p>
 
 
    </section>
</body>
 
</html>


Output:

What is the difference between and tags in HTML ?

The <div> tag and <section> tag are used in the webpage, the <section> tag means that the content inside relates to a single theme, and the <div> tag is used as a block part of the web page.

Table of Content

  • HTML div Tag
  • HTML section Tag

Similar Reads

HTML div Tag

It is called a division tag. The

HTML section Tag

...

Differences between