Structuring with <section>

Hi, I'm Ahbab. In this article, I'll teach you about the semantic <section> element in HTML, its purpose, and how to use it effectively to organize your web pages.

What is the <section> Element?

The <section> element is a semantic HTML5 tag used to group related content together. It represents a thematic grouping of content, typically with a heading, and is useful for organizing your web pages into logical sections.

Why Use <section>?

Example: Grouping Content with <section>

<section>
    <h2>About Us</h2>
    <p>We are a team of passionate developers.</p>
</section>

<section>
    <h2>Contact Us</h2>
    <p>Email: contact@example.com</p>
</section>
        

In this example, the <section> element is used to group content into "About Us" and "Contact Us" sections, making the page more organized.

When Should You Use <section>?

Practice: Try It Yourself

  1. Project: Portfolio Sections
    Create a portfolio page with sections for "About Me," "Projects," and "Contact." Use headings and paragraphs within each section.
  2. Project: Product Page
    Build a product page with sections for "Features," "Pricing," and "Reviews." Add headings and content to each section.

Continue Learning

Quick Check

The <section> element groups content by a common theme. True or False?