Skip to content

Primitives

Four classes that cover most layouts without a single media query.

Each primitive replaces the margins of its children with a gap, and adapts to the space it has rather than the screen size. That makes them work the same in a sidebar, a card or the full page.

Stack

.stack spaces its children vertically.

One
Two
Three

Cluster

.cluster puts its children in a row that wraps, for tags, buttons and toolbars.

HTML
CSS
Custom properties
Cascade layers
Container queries

With sidebar

.with-sidebar puts a fixed width first child next to fluid content. When the content would get narrower than half the row, the two stack. This docs page uses it for the menu.

Sidebar
Content

.end puts the sidebar last.

Content
Sidebar

Switcher

.switcher shows its children in one row while it is wider than --i-switcher-threshold (40rem), and in one column below it. There is never a two plus one wrap. More than four children always stack.

One
Two
Three

Nesting

Primitives nest freely. A common page: a stack of sections, with a cluster of buttons inside.

Ready to start?

Link one stylesheet and write HTML.

Variables

VariableDefault
--i-stack-gapvar(--i-spacing)
--i-cluster-gapcalc(var(--i-spacing) * 0.5)
--i-sidebar-gapvar(--i-spacing)
--i-sidebar-width16rem
--i-sidebar-content-min-widthThe content wraps below the sidebar once it would be narrower than this50%
--i-switcher-gapvar(--i-spacing)
--i-switcher-thresholdContainer width below which a switcher stacks its children40rem