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

thead

The thead element groups header rows in a table. Vanilla Breeze styles it with a raised background and a medium bottom border to visually separate column headers from data.

Description

The <thead> element contains one or more <tr> elements that define the header row(s) of a table. It must appear after any <caption> or <colgroup> elements and before <tbody> and <tfoot>.

Vanilla Breeze styles <thead> header cells with a raised background (var(--color-surface-raised)) and a thicker bottom border (var(--border-width-medium)) to visually separate headers from data rows.

When to Use

  • Every data table: All tables with meaningful data should have thead to define column headers
  • Multiple header rows: When columns have grouped headers or sub-headers
  • Printed tables: Headers repeat on each page when printing long tables
  • Sticky headers: Use data-sticky="header" on the table so headers remain visible while scrolling

Examples

Basic Table with thead

A complete table using thead with <th scope="col"> for column headers, alongside <tbody> and <tfoot>.

Sticky Header

Add data-sticky="header" to the <table> element so the header row stays visible as the user scrolls through long tables. VB applies position: sticky, inset-block-start: var(--sticky-offset, 0px), and z-index: 1 to the thead th cells, and redraws the header rule as an inset shadow so it stays with the stuck cells.

Sticky header caveats

  • It sticks to the nearest scroller. Normally that is the page. Inside a [data-table-scroll] region the header pins to the region instead (at 0); use data-table-scroll="block" to give the region a height so there is something to scroll.
  • It clears the site header. When the page uses a coordinated sticky header (header data-sticky), the thead offsets by --sticky-offset so it never slides underneath.
  • Print resets it. In print the header is static and repeats on every page instead.

Scope Attribute

The scope attribute on <th> tells assistive technologies which cells the header relates to. See the shared demo for headers using scope="col" and scope="row".

CSS Reference

Vanilla Breeze applies these styles to <th> elements within thead:

Property Value Purpose
background var(--color-surface-raised) Subtle background to distinguish headers from data
border-block-end var(--border-width-medium) solid var(--color-border) Thicker border separating header from body
position: sticky Via data-sticky="header" or "both" Header stays fixed at the top when scrolling
z-index 1 Ensures sticky header paints above body rows

Accessibility

  • Structural grouping: Helps assistive technologies distinguish header rows from data rows
  • Always use scope: Set scope="col" on each <th> inside thead so screen readers announce the header for each column
  • Grouped headers: Use scope="colgroup" with colspan for multi-column header groups
  • Implicit role: thead has an implicit ARIA role of rowgroup
  • Repeated headers: When printing, thead content can repeat on each page

Related

  • <table> - Parent container for thead
  • <tr> - Table rows within thead
  • <th> - Header cells (always use in thead with scope)
  • <tbody> - Data row group (follows thead)
  • <tfoot> - Footer row group for summaries and totals
  • <data-table> - Enhanced table component with sorting, filtering, and pagination
↑