Codectionary / Developer documentation / HTML

<section>

The <section> element groups related content that typically has its own heading, representing a distinct thematic section of a document — like a chapter, tab panel, or a chunk of a landing page. Unlike <div>, which carries no semantic meaning, <section> tells browsers and assistive technology that its content forms a standalone, related group. If content does not have a natural heading or is not thematically distinct, a plain <div> is usually the better choice.

Syntax

<section>
  <h2>Section Title</h2>
  <p>Section content...</p>
</section>

Examples

Landing Page Sections

Breaking a page into distinct thematic sections.

<section>
  <h2>Features</h2>
  <p>Everything you need to learn to code.</p>
</section>

<section>
  <h2>Pricing</h2>
  <p>Free forever for individual learners.</p>
</section>

Section Within an Article

Using sections to divide a long article into parts.

<article>
  <h1>The Complete Guide to Flexbox</h1>
  <section>
    <h2>What is Flexbox?</h2>
    <p>Flexbox is a one-dimensional layout model...</p>
  </section>
  <section>
    <h2>Main Properties</h2>
    <p>justify-content, align-items, and flex-direction...</p>
  </section>
</article>

Styled Section

A visually separated content section.

<section style="padding: 40px 20px; background: #f9fafb; border-radius: 12px;">
  <h2 style="margin-bottom: 12px;">Why Choose Us</h2>
  <p>We focus on practical, hands-on learning.</p>
</section>

Best practices

  • Only use <section> when the content is thematically related and would make sense with its own heading
  • If you just need a styling hook with no semantic meaning, use <div> instead
  • Give each <section> a heading (<h2>-<h6>) so it makes sense in a document outline
  • Do not use <section> as a wrapper purely for CSS layout purposes — that dilutes its semantic value

Browser compatibility

Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.

<section>

Desktop

Chrome
Supported
From 5
Firefox
Supported
From 4
Safari
Supported
From 5
Edge
Supported
From 12
Opera
Supported
From 11.1

Mobile

Safari on iOS
Supported
From 4.2
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 4
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • From 5

Firefox

  • From 4

Safari

  • From 5

Edge

  • From 12

Opera

  • From 11.1

Safari on iOS

  • From 4.2

Chrome for Android

  • From 18

Firefox for Android

  • From 4

Samsung Internet

  • From 1.0

MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.

HTML Living Standard

Specifications & further reading