start learning
Image 1
318

HTML Section tag

The HTML <section> tag defines a thematic grouping of content within a web page. It's used to mark up content that forms a distinct, self-contained section of a document. The content inside a <section> tag should be related in some meaningful way, and the tag is often used to divide a page into different chapters, topics, or content blocks.

Here's an example of how the <section> tag can be used in an HTML document:


<!DOCTYPE html>
<html>
<head>
    <title>Sample Page</title>
</head>
<body>
      <header>
        <!-- Header content here including h1 heading title -->
    </header>
<main>
        <section>
            <h2>About Us</h2>
            <p>We are a company that specializes in...</p>
        </section>

        <section>
            <h2>Our Services</h2>
            <p>We offer a variety of services, including...</p>
        </section>
</main>
<footer>
        <!-- Footer content here -->
    </footer>
</body>
</html>

In this example, the <section> tag is used to group related content under headings such as "About Us" and "Our Services. " Each <section> encapsulates content that is thematically connected and can stand alone as a meaningful unit.

Using the <section> tag helps provide semantic structure to your HTML document, making it easier for both human readers and search engines to identify and understand the different sections of your content. This can also improve accessibility by allowing assistive technologies to navigate and comprehend the content more effectively.

×