Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

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 it has no heading, it is not a section: in VB, group the content with a layout element (<layout-stack>, <layout-cluster>, …) or put data-layout on the parent, rather than reaching for a <div>.

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

Generous block and inline padding for page-level bands. Despite the name it does not break out to the viewport: the section stays as wide as its container.

.contained

Max-width container for centered content.

Sections within an article

Thematic grouping of content within an article.

Page-Band Attributes

For landing pages built from stacked full-width bands, sections also take a few data attributes.

data-padding

Fluid block padding that scales with the viewport. Bare data-padding is the normal step; small, xsmall and none step down. data-padding-start="none" and data-padding-end="none" drop one side so neighbouring bands butt together.

section.hero[data-bleed]

The hero's background extends up behind the site header (body > header), and that header turns transparent. Set data-scrolled on <html> from your own script, for example an IntersectionObserver on the hero, to give the header its surface back once the hero scrolls away. The overlap height comes from --site-header-height (default 4rem).

Check text contrast on the header while it sits over the hero background.

data-angle

Skews the section's background along one edge for an angled transition: down and down-strong slope the top edge, up and up-strong the bottom edge. Extra block padding keeps content clear of the slope. The slope mirrors under dir="rtl". Give the section a background, otherwise there is nothing to skew.

Hairline rules: section > hr[data-position]

A direct-child <hr data-position="top"> or data-position="bottom" becomes an edge-to-edge rule pinned to that edge of the section, taken out of the content flow.

Container Behavior

Every <section> (like main, article and most asides) is a size query container: VB gives it container-type: inline-size. Two consequences:

  • Container units and queries resolve against the section. cqi units and @container queries inside it measure the section, not the viewport.
  • A content-sized section can collapse. Size containment ignores the section's content when working out its width. As a flex or grid item that is sized by its content (a display: flex row, an align-items: center column, an auto track), the section shrinks to zero width. VB already undoes this inside layout-cluster, layout-reel, centred layout-cover and aligned layout-stack.

Elsewhere, opt out by setting container-type: normal on the section in your own CSS, or give it an explicit size. Inside the layouts above, add data-container to a section to keep it as a container on purpose.

Variants

Class Description
.padded Vertical padding (--size-xl) for spacing
.full Generous block (2xl) and inline (l) padding; no breakout
.contained Max-width 1200px, centered with horizontal padding
.alt Raised background color for visual alternation (block borders in forced-colors mode)
.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
Attribute Values Description
data-padding (bare), small, xsmall, none Fluid block padding
data-padding-start / data-padding-end none Remove block-start or block-end padding
data-bleed boolean, on section.hero Background extends behind body > header, which turns transparent until <html data-scrolled>
data-angle down, up, down-strong, up-strong Skewed background edge with padding compensation; mirrors in RTL
data-container boolean Keep the section a query container inside content-sized layouts
hr[data-position] (child) top, bottom Edge-to-edge hairline pinned to that edge

Accessibility

  • A <section> is a region landmark only when it has an accessible name, e.g. aria-labelledby pointing at its heading (or aria-label). A heading alone does not make it a landmark.
  • Name only the few sections a user would want to jump to. Naming every section floods the landmark list and makes it less useful.
  • Always include a heading (h2-h6) so the section shows up in heading navigation
  • Use appropriate heading levels - don't skip levels for visual styling
  • If a section has no meaningful heading, it is not a section: use a VB layout element or data-layout on the parent
  • 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
  • In forced-colors mode backgrounds are flattened, so .alt sections gain a system-colour border to stay distinct

Named Region Example

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
↑