stnd.build

Rhythm

Rosetta Stone: Vertical Rhythm & Baseline Cadence

All vertical spacing in Standard is anchored to a single root line-height unit: var(--baseline) (1rlh), aliased as var(--space). Inside .rhythm or .prose containers, block elements automatically space themselves by var(--space). When building app UI bars or card grids where gap handles spacing, add .no-rhythm to suppress automatic sibling margins.

.rhythm (Editorial Flow)

Paragraph 1 automatically receives 1rlh margin-block spacing.

Paragraph 2 stays locked to the vertical baseline grid.

.no-rhythm (UI Controls)

Paragraph 1 has zero automatic margin.

Paragraph 2 stacks flush so flex/grid gap is in full control.

Intention HTML Utility / Scope CSS Token (var(...))
Enable automatic vertical cadence .rhythm (or .prose) --baseline: 1rlh, --space: var(--baseline)
Disable automatic rhythm on UI subtree .no-rhythm Strips automatic margin-block from descendants
Half-line step .p-half, .gap-half var(--space-half) (calc(var(--space) / 2))
Quarter-line micro trim .p-trim, .gap-compact var(--trim) (calc(var(--space) / 4))

Rhythm

Layout

Vertical rhythm for any container: apply .rhythm and its children get consistent margin-block-start spacing with no per-element classes, heavier before headings and around block-level elements (tables, blockquotes, figures — the tags this cascades to are declared once in _standard-00-variables.scss, not here). .flex > * is zeroed out automatically so rhythm margins never stack with flex gap.

Name Description
.rhythm The container class. Sets display: flow-root so child margins cannot collapse out of it.
.no-rhythm Zeroes margin-block-start on every descendant — a subtree-wide rhythm opt-out.
--rhythm-block-scale Rhythm multiplier factor for block-level spacing and heading exceptions.
.flex > * Zeroes margin-block-start for flex children so margins do not stack with flex gap.

Turn any container into a rhythm block

<article class="rhythm">
  <h2>Heading</h2>
  <p>Spaced automatically — no margin utility classes needed.</p>
</article>

Live

Heading

Spaced automatically — no margin utility classes needed.

Opting a subtree out of the rhythm

<div class="rhythm">
  <p>A paragraph in the rhythm.</p>
  <div class="no-rhythm">
    <p>No spacing before this one.</p>
    <p>Nor this one: the whole subtree is tight.</p>
  </div>
  <p>Back in the rhythm.</p>
</div>

Live

A paragraph in the rhythm.

No spacing before this one.

Nor this one: the whole subtree is tight.

Back in the rhythm.

Flex children do not stack their rhythm margins with the gap

<div class="rhythm">
  <div class="flex" style="gap: var(--space)">
    <p>One</p><p>Two</p><p>Three</p>
  </div>
</div>

Live

One

Two

Three

All classes

Other

Class Declares
.no-rhythm * margin-block-start: 0