section

A thematic grouping of content, typically with a heading. Use for chapters, tabbed panels, numbered sections, or any content that would appear in an outline.

Usage

Use the <section> element for:

  • Chapters or thematic groups within an article
  • Each panel in a tabbed interface
  • Major sections of a homepage (hero, features, testimonials)
  • Numbered or labeled sections in documentation

A section should have a heading that identifies its content. If you cannot provide a meaningful heading, consider whether <div> would be more appropriate.

Examples

Default

Basic section with heading and content.

.alt

Alternate background for visual rhythm between stacked sections.

.bordered

Top border for visual separation.

.hero

Hero section with centered content and minimum height.

.grid

Auto-fit grid layout for card grids.

.padded

Vertical padding for spacing between sections.

.full

Full-width section with padding, ideal for page-level sections.

.contained

Max-width container for centered content.

Sections within an article

Thematic grouping of content within an article.

Variants

Class Description
.padded Vertical padding (--size-xl) for spacing
.full Full width with generous block and inline padding
.contained Max-width 1200px, centered with horizontal padding
.alt Raised background color for visual alternation
.bordered Top border with padding for visual separation
.hero Centered content, minimum 50vh height, generous padding
.grid Auto-fit grid layout for responsive card arrangements

Accessibility

  • Sections with headings create region landmarks that screen readers can navigate to
  • Always include a heading (h2-h6) to label the section content
  • Use appropriate heading levels - don't skip levels for visual styling
  • If a section has no meaningful heading, consider using <div> instead
  • Hero sections should still have a proper h1 for the page title
  • Grid sections should use semantic elements (like <article>) for grid items when appropriate

Related

  • <article> - For self-contained, distributable content (section is for thematic grouping)
  • <aside> - For tangentially related content (section is for primary content)
  • <main> - Sections are often children of main
  • <header> - Sections can have their own headers
  • <hgroup> - For section headings with subtitles