HTML <section> Tag

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 2 Examples
Semantic HTML

What You’ll Learn

The <section> tag is a powerful semantic element for defining thematic sections within a document. This guide covers syntax, attributes, structuring content, accessibility, and best practices for beginners.

01

Semantic HTML

Group related content.

02

Syntax

Block-level element.

03

class / id

Style and target.

04

Structure

Chapters & groups.

05

A11y & SEO

Clear page outline.

06

Best Practices

When to use section.

What Is the <section> Tag?

The <section> tag is a block-level element that helps structure and organize content on a webpage. It groups thematically related content, making the document’s structure easier to understand for users, search engines, and assistive technology.

Valid HTML5 — Sectioning Element

Use section when content forms a distinct thematic group with its own heading — not merely for styling wrappers.

Each section should typically include a heading (h1h6). If you only need a generic container without semantic meaning, use <div> instead.

📝 Syntax

Enclose the content you want to group within opening and closing section tags:

syntax.html
<section>
  <!-- Your content here -->
</section>

Syntax Rules

  • Include a heading inside each section when possible.
  • Use section for thematic grouping, not as a replacement for div styling.
  • Nesting section elements is valid when a subsection belongs to a larger section.
  • Do not use section as a generic page wrapper — use main or body content areas.

⚡ Quick Reference

TopicCode SnippetNotes
Basic section<section>...</section>Thematic group
With heading<h2> inside sectionRecommended
Styling hookclass="intro"Global attribute
vs articlesection = groupingNot standalone
vs divsection = semanticdiv = generic
Landmark roleregion when namedExposed to AT

⚖️ <section> vs <article> vs <div>

ElementPurposeExample
<section>Thematic group within a pageIntroduction, features list, contact form group
<article>Self-contained, distributable contentBlog post, news story, product card
<div>Generic container, no semantic roleLayout grid, icon wrapper, CSS hook
Rule of thumbIf it could appear alone in an RSS feed, use article

🧰 Attributes

The <section> tag has no tag-specific attributes. It supports global attributes like class and id for styling and targeting with CSS or JavaScript.

attributes.html
<section class="main-section" id="intro-section">
  <!-- Your content here -->
</section>
class / id Global

Apply styles or target specific sections with CSS selectors and JavaScript.

class="main-section" id="intro-section"
lang Optional

Declare the language of content inside the section when it differs from the page.

lang="es"
aria-labelledby A11y

Names the section landmark for screen readers when multiple unnamed sections exist.

aria-labelledby="features-heading"
style / data-* Optional

Inline styles or custom data attributes for templates and JavaScript hooks.

data-tab="overview"

Examples Gallery

Divide pages into clear, thematic sections with semantic HTML and beginner-friendly examples.

👀 Live Preview

A page divided into three thematic sections:

Introduction

Your introductory content here.

Main Content

Your main content goes here.

Conclusion

Summarize your key points in this section.

📚 Common Use Cases

The primary purpose of <section> is to divide your document into thematic sections that make sense in the context of your webpage.

Structuring Content

Use section to organize content such as articles, chapters, or any grouping that forms a distinct part of your page. Each section should include a descriptive heading.

structuring-content.html
<section>
  <h2>Introduction</h2>
  <p>Your introductory content here.</p>
</section>

<section>
  <h2>Main Content</h2>
  <p>Your main content goes here.</p>
</section>

<section>
  <h2>Conclusion</h2>
  <p>Summarize your key points in this section.</p>
</section>
Try It Yourself

Accessibility and SEO

Using section tags properly enhances accessibility and search engine optimization. Screen readers and search engines better understand your content when it is organized with semantic elements and clear headings.

accessibility-seo.html
<main>
  <section aria-labelledby="features-heading">
    <h2 id="features-heading">Product Features</h2>
    <p>Organized sections help assistive technology navigate your page.</p>
  </section>
</main>

♿ Accessibility

  • Include headings — Each section should have an h1h6 that describes its topic.
  • Name landmarks — Use aria-labelledby when the section heading is not sufficient for screen reader navigation.
  • Do not overuse sections — Too many unnamed section landmarks can clutter the page outline for assistive technology.
  • Prefer semantic elements — Use nav, aside, or article when those roles fit better than a generic section.

🧠 How <section> Works

1

Author groups content

Related paragraphs, lists, and media are wrapped in a section element.

Markup
2

Browser exposes landmark

When named, the section becomes a region landmark for assistive technology.

Semantics
3

CSS styles the block

Use class or id to layout and style each thematic group.

Presentation
=

Clear, organized pages

Users, crawlers, and screen readers all benefit from a logical document outline.

Browser Support

The <section> tag is supported in all modern browsers. Internet Explorer 9+ recognizes the element; IE 8 and below treat it as a generic block without semantic meaning.

Baseline · HTML5

Semantic structure everywhere

From IE 9 to the latest browsers — section is a core HTML5 sectioning element.

100% Modern browser support
Google Chrome Fully supported
Full support
Mozilla Firefox Fully supported
Full support
Apple Safari Fully supported
Full support
Microsoft Edge Fully supported
Full support
Internet Explorer IE 9+ full · IE 8 generic block
Partial support
Opera Fully supported
Full support
<section> tag 100% modern · IE 9+

Bottom line: Test in target browsers, but <section> is safe for all modern projects.

Conclusion

Incorporating the <section> tag into your HTML documents improves both the structure of your webpage and its accessibility. By embracing semantic elements like section, you contribute to a more organized and user-friendly web.

💡 Best Practices

✅ Do

  • Use section when grouping related content thematically
  • Include a heading inside each section
  • Nest sections when a subsection belongs to a larger section
  • Test your layout across browsers for a seamless experience

❌ Don’t

  • Use section only for styling — use div instead
  • Wrap the entire page in a single unnamed section
  • Replace article when content is self-contained and distributable
  • Skip headings inside sections without good reason

Key Takeaways

Knowledge Unlocked

Six truths every developer should know about <section>

Bookmark these before you structure your next page.

6
Core concepts
📝 02

Headings

h2–h6 inside.

Structure
🎨 03

class / id

Style & target.

Attributes
⚖️ 04

vs article

Grouping only.

Comparison
05

A11y & SEO

Clear outline.

Benefits
🌐 06

IE 9+

Modern safe.

Compatibility

❓ Frequently Asked Questions

It groups thematically related content within a page, such as chapters, tabs, or grouped form fields.
section carries semantic meaning and should include a heading. div is a generic container with no semantic role.
article is for self-contained content like blog posts. section groups content within a page.
No. Use global attributes like class, id, and aria-labelledby.
Yes in all modern browsers. IE 9+ recognizes section; IE 8 and below treat it as a generic block.

Structure your pages semantically

Practice <section> with class, id, and multi-section layouts in the Try It editor.

Try structuring content →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful