For the complete documentation index, see llms.txt. This page is also available as Markdown.

Layout utilities

Utilities for arranging content: flex shorthands, grid stacking, layout-variable gaps and padding, and content alignment.

Utilities for arranging content: flex shorthands, grid stacking, layout-variable gaps and padding, and content alignment.

Class
What it does

flex-center

align-items: center; justify-content: center. Add flex or grid since it doesn't set display

flex-row-center

display: flex; flex-direction: row; align-items: center

justify-center-safe / justify-end-safe

justify-content: safe center / safe flex-end, so overflowing items stay reachable instead of clipping off-screen

flex-row / flex-col / flex-row-reverse / flex-col-reverse

Set flex-direction plus the flow variables --flex-direction, --flex-across, --flex-down. The theme replaces Tailwind's own flex-direction utilities with these

vars-row / vars-col

Set only --flex-across / --flex-down, without touching flex-direction

grid-stack

A one-cell grid. Every direct child gets grid-area: 1/1, so children layer on the z-axis while the parent stretches to fit the tallest one

grid-stack-item

grid-area: 1/1 on the element itself, for children of some other grid

area-[…]

grid-area with an arbitrary named area (area-[content]) or line numbers (area-[1/1/-1/-1]). There are no preset names

gap-layout / gap-x-layout / gap-y-layout

Gap from the layout gutter variables --layout-gutter-x / --layout-gutter-y

gap-sm / gap-md / gap-lg

Gap from the theme spacing settings: row-gap: var(--raw-space-*), column-gap: var(--root-space-*)

p-layout, p{x|y|t|b|l|r|s|e}-layout

Padding from the layout buffer variables --layout-buffer-x / --layout-buffer-y

p-gutter, p{x|y|t|b|l|r|s|e}-gutter

Padding from the layout gutter variables

m-layout, m{x|y|t|b|l|r|s|e}-layout

Margin from the layout buffer variables

m-gutter, m{x|y|t|b|l|r|s|e}-gutter

Margin from the layout gutter variables

vars-content-align-{start|center|end}

Sets --content-align for the subtree (-left / -right are legacy aliases for start / end)

text-content-align

text-align: var(--content-align)

items-content-align / justify-content-align / justify-self-content-align / justify-items-content-align

Apply var(--content-align) to align-items / justify-content / justify-self / justify-items

items-content-gravity

align-items: var(--content-gravity)

scroll-area-x / scroll-area-y

One-axis scroll region: overflow on that axis, contained overscroll, hidden scrollbars

Buffer is the space outside content. Gutter is the space between content. Both come from the --layout-* variables and can be overridden by a section. Alignment uses two variables: --content-align controls the x axis (like text-align) and --content-gravity controls the y axis. Both take start, center, or end.

Examples

Centering content

Use flex-row-center for a horizontal row with vertically centered items, or flex with flex-center to center both axes:

Layout gaps

Use gap-layout to space children by the section's gutter:

The gap uses the merchant's spacing setting and any gutter override on the section.

Stacking children

Use grid-stack to layer children in one grid cell:

Unlike position: absolute, the parent stretches to fit the tallest child instead of collapsing to zero height. The before/after slider and core-section-background both stack this way.

Placing content in grid areas

Use area-[…] to place an element into a named grid area:

core-placement-grid uses area-[1/1/-1/-1] to make the content take the whole grid when there are no controls.

Aligning content from a setting

Use vars-content-align-{{ block.settings.content_align }} on a wrapper, then the *-content-align helpers on descendants:

Every vars-* class is safelisted in tailwind.config.ts. You can assemble the class name in Liquid without adding the literal elsewhere.

Scroll areas

Use scroll-area-y for a vertical scroll region with hidden scrollbars:

Contained overscroll keeps the page behind a drawer from scrolling when the drawer reaches its end.

Customizing

Gutter and buffer values come from the merchant's spacing settings and use the --layout-* variables. See Global settings & local overrides and Scaling: size, space & rhythm. Fixed gap steps use the r1–r15 scale. See Spacing.

Last updated

Was this helpful?