<section> Tag in HTML

The <section> tag in HTML represents a standalone section of content within a document. It is used to group related content and can be used to break up a page into different sections. Typically, each section can have its own heading and structure. The <section> tag is commonly used for content that could be independently distributed or reused.

Key Points on <section> Tag:

Syntax of <section> Tag:

Syntax Example

<section>
            <h2>Section Title</h2>
            <p>Content of the section goes here.</p>
        </section>

Example of <section> Tag in HTML:

This example demonstrates how to use the <section> tag to organize content on a webpage.

Code Example

<!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>HTML <section> Tag Example</title>
        </head>
        <body>
        
            <h1>My Webpage</h1>
        
            <section>
                <h2>About Us</h2>
                <p>This section contains information about the company and its mission.</p>
            </section>
        
            <section>
                <h2>Services</h2>
                <p>We offer a variety of services, including web development, marketing, and consulting.</p>
            </section>
        
            <section>
                <h2>Contact</h2>
                <p>You can contact us via email or phone. Our office is located at 123 Main Street.</p>
            </section>
        
        </body>
        </html>

Output

My Webpage

About Us

This section contains information about the company and its mission.

Services

We offer a variety of services, including web development, marketing, and consulting.

Contact

You can contact us via email or phone. Our office is located at 123 Main Street.

The <section> tag is a powerful tool for structuring content on a webpage. It allows you to group related content together in a logical way, making your page more organized and easier to navigate. Using sections improves accessibility, SEO, and the overall readability of your content, especially for complex websites.