Skip to main content

The Div element (Flex · Grid · Block)

The Div is the modern layout primitive of the Page Builder — one container you set to Flex, Grid, or Block. It replaces the classic Section → Row → Column scaffolding with a single element that maps directly to how a developer writes a layout by hand (<section><div class="grid">…</div></section>), so the DOM stays clean and semantic. The classic grid is still fully supported — see the Roadmap for how the two models coexist.

Two flexboxes, one engine

The same primitive powers the Theme Builder's Flexbox (scoped to header/body/footer parts). This page documents the Div as it appears on Pages and Posts. The controls below are shared.

Getting one

The Layout tab leads with three Div presets — each is the same Div with a different starting Display and HTML tag:

TileCreatesReach for it when…
Sectiona Div tagged <section>, content auto-contained to the site widthyou're starting the root band of a page
Grida Div set to display: gridyou want columns — a card grid, an even split, a hero
Flexboxa Div set to display: flexyou want a one-dimensional row or stack that can wrap

Everything after this is just options on that one element.

Display — how it arranges its children

The Display select is the master switch. It decides which of the option groups below apply:

DisplayChildren flow asControls it reveals
Flex (default)one axis — a row or a stackDirection, Wrap, Justify, Align, Gap, Align Content, Reverse
Grida two-axis gridGrid Columns, Auto-fit, Min Column Width, Dense Packing (+ Gap / Justify / Align)
Blocknormal document flownone — just a styled box

Flex controls

OptionWhat it does
DirectionRow places children side by side (give each a Width to split the row); Column stacks them. Responsive — a Row header can stack to a Column on phones.
WrapLets a row flow onto multiple lines when the children don't fit.
Justify (main axis)Distributes children along the direction axis — start / center / end / space-between / space-around / space-evenly.
Align (cross axis)Aligns children across the axis — stretch / start / center / end / baseline.
Gap / Row Gap / Column GapSpacing between children, from the spacing-scale presets. Responsive.
Align Content (wrapped lines)With Wrap on, how the wrapped lines pack vertically.
Reverse OrderFlips the visual order (row-reverse / column-reverse) without touching the DOM order.

Grid controls

OptionWhat it does
Grid ColumnsA number (3 = three equal columns) or a raw grid-template-columns value (2fr 1fr). Set 12 for a spanning grid: each child then uses its own Width as a track span — 1/3 = 4 tracks, 2/3 = 8 — so 1/3 + 2/3 tiles exactly.
Auto-fit ColumnsIgnores the count and fits as many equal columns as the width allows, each at least the Min Column Width, reflowing with no breakpoints (repeat(auto-fit, minmax(…, 1fr))).
Min Column WidthThe min in minmax(min, 1fr) — smallest a column gets before Auto-fit drops one.
Dense Packinggrid-auto-flow: dense — backfills holes left by spanned cells. Can reorder items visually.

Width Override — the star control

Width Override sets how wide this Div sits inside its parent. It's a responsive control with Desktop / Tablet / Phone layers (base / md / lg), each offering the same picker:

Twelfths (the familiar fractions)

The 12-column grid in lowest terms — one click each. These emit a clean fw-span-{n} class (no inline CSS):

1/12 · 1/6 · 1/4 · 1/3 · 5/12 · 1/2 · 7/12 · 2/3 · 3/4 · 5/6 · 11/12 · 1/1

So a 1/2 cell is fw-span-6, a 1/3 is fw-span-4. Two 1/2 Divs in a Row split it evenly; three 1/3 Divs make thirds.

Fifths

A twelfths grid can't express fifths in lowest terms, so these are their own tiles — 1/5, 2/5, 3/5, 4/5 — for clean five-column layouts. Because there's no matching grid class, each renders as an exact percentage via a small scoped <style> rule:

TileEmits
1/5flex: 0 0 20%; max-width: 20%
2/5flex: 0 0 40%; max-width: 40%
3/5flex: 0 0 60%; max-width: 60%
4/5flex: 0 0 80%; max-width: 80%
Fifths differ from the classic column

On the classic Section → Row → Column grid, only 1_5 exists (see Column widths). The modern Div supports the full 1/5 – 4/5 set, so a 2/5 + 3/5 split is one click each.

Content-sizing keywords

Three intrinsic-sizing widths let a Div size to its own content instead of a fraction of the row. They emit flex: 0 0 auto with a CSS keyword width:

TileEmitsUse for
Fitwidth: fit-contenta button, a pill, a badge — as wide as its text, no wider
Maxwidth: max-contentnever wraps — the widest the content wants to be
Minwidth: min-contentas narrow as the content allows (wraps at every soft break)

Auto and Custom

TileMeaning
Auto (none)Inherit the natural flex behaviour — the child fills or shares the remaining space. Nothing is emitted.
CustomA free value in px / % / rem / vw — for a width no preset covers. Emits a scoped rule.

Because fifths, content-sizing and custom values are per-element scoped CSS (keyed to the Div's unique id), they never leak to siblings and cost no global stylesheet weight.

How this Div behaves as a flex item

When the Div's parent is a Flex container, these fine-tune how it participates:

OptionEffect
Grow to Fillflex-grow: 1 — expand to eat leftover space.
Prevent Shrinkingflex-shrink: 0 — never squeeze below its width.
Align SelfOverride the parent's cross-axis alignment for just this child.
OrderMove this child earlier/later visually without changing the DOM order.

Container & styling

OptionNotes
HTML TagThe semantic element emitted — div (plain), section (a titled band), article (self-contained/repeatable, e.g. cards), aside (complementary). You pick the tag, you get that tag.
Content WidthConstrain the Div's content to a centred max-width (like a container). A section-tag Div does this automatically at the site width; for a full-bleed band with contained content, nest a contained Div inside a full-width one.
BackgroundThe shared background-pro control (colour / gradient / image / video overlay).
Border / Box StyleBorder, radius and shadow presets.
Min HeightResponsive minimum height (e.g. a 100vh hero).
Aspect RatioLock the box to a ratio (16:9, 1:1, …).
Margin & PaddingPer-side spacing, responsive.

Clean output

The Div exists to produce semantic, framework-free HTML: you choose nav, you get a <nav>; you set three equal columns, you get a real CSS Grid — not div.row > div.col-md-4 scaffolding and a wall of utility classes. That's the same clean-DOM philosophy the whole builder is moving toward.

See also