Skip to content

Columns & Layout

Alignment, ordering, display, and positioning utilities for flex and grid layouts. Included in @grundtone/design-tokens CSS — see Installation for setup.

All utilities support responsive prefixes: sm:, md:, lg:, xl:, 2xl:. Mobile-first — base classes apply at all sizes, prefixed classes from that breakpoint up.


Vertical alignment

Use items-{value} to align items along the cross axis. Works on both flex and grid containers.

items-start

items-start
tall
short

items-center

items-center
tall
short

items-end

items-end
tall
short

items-stretch

items-stretch
stretches
to fill

Horizontal alignment

Use justify-{value} to distribute items along the main axis.

justify-center

A
B
C

justify-between

A
B
C

justify-evenly

A
B
C

Individual alignment

Override the container's alignment on a single item with self-{value}:

self-start
self-center
self-end
self-stretch

Grid alignment

Grid layouts support additional alignment utilities that don't exist in flexbox:

place-items

place-items-center centers items both horizontally and vertically in their grid cells:

A
B
C

Mixed alignment in grid

Combine container alignment with individual overrides:

centered
self-start
self-end

Display utilities

Switch display mode on any element. .flex and .grid are the most common.

Flex item 1
Flex item 2
Flex item 3

Responsive visibility

Combine hidden with responsive display classes for conditional visibility:

Visible only below md — block md:hidden
ClassCSS
.blockdisplay: block
.inline-blockdisplay: inline-block
.inlinedisplay: inline
.flexdisplay: flex
.inline-flexdisplay: inline-flex
.griddisplay: grid
.inline-griddisplay: inline-grid
.contentsdisplay: contents
.hiddendisplay: none

Flex direction

Control the direction of flex items. Stack vertically with flex-col, horizontal with flex-row (default):

flex-col: A
flex-col: B
flex-col: C

Responsive direction

Switch from stacked to horizontal at a breakpoint:

Stacked on mobile
Row from md up
flex-col md:flex-row
ClassCSS
.flex-rowflex-direction: row
.flex-colflex-direction: column
.flex-row-reverseflex-direction: row-reverse
.flex-col-reverseflex-direction: column-reverse

Flex wrap

Allow items to wrap when they exceed the container width:

One
Two
Three
Four
Five
ClassCSS
.flex-wrapflex-wrap: wrap
.flex-nowrapflex-wrap: nowrap
.flex-wrap-reverseflex-wrap: wrap-reverse

Grow & shrink

Control how flex items grow and shrink:

grow (fills space)
grow-0 (fixed)
ClassCSS
.flex-1flex: 1 1 0%
.flex-autoflex: 1 1 auto
.flex-initialflex: 0 1 auto
.flex-noneflex: none
.growflex-grow: 1
.grow-0flex-grow: 0
.shrinkflex-shrink: 1
.shrink-0flex-shrink: 0

Order

Reorder flex or grid items without changing HTML order.

Basic ordering

A (order-3)
B (order-1)
C (order-2)

First and last

A (order-last)
B (no order)
C (order-first)

Responsive reordering

Show sidebar last on mobile, first on desktop:

Sidebar (last on mobile, first from md)
Main content
ClassCSS
.order-firstorder: -9999
.order-lastorder: 9999
.order-noneorder: 0
.order-1.order-12order: 112

Offsetting columns

Bootstrap uses offset-* classes. In CSS Grid, offsets aren't needed — use col-start-* and col-end-* instead, which are more powerful and flexible.

Basic offset

Position an item starting at column 4 (effectively an offset of 3):

col-start-4 col-span-6 (offset of 3)

Responsive offset

Full-width on mobile, then progressively offset on larger screens:

Full on mobile, offset-2 from md, offset-3 from lg

Centering with col-start / col-end

col-start-4 col-end-10 — centered in the grid

Why col-start replaces offset

FeatureBootstrap offset-*Grundtone col-start-*
Push from leftoffset-md-3md:col-start-4
Push from rightNot possiblemd:col-end-10
Span + positionoffset-3 + col-md-6col-start-4 col-span-6
Exact start + endNot possiblecol-start-4 col-end-10
Works with CSS GridNo (flexbox only)Yes (native grid lines)
Responsiveoffset-md-3md:col-start-4

Key insight: col-start-N and col-end-N can position items at both start AND end of the grid. Bootstrap's offset-* can only push from the left. With CSS Grid, you get full positional control.


Combined layout

A real-world example combining display, direction, alignment, grow/shrink, and order:

Main content (grow)
html
<div class="flex flex-col md:flex-row gap-4 items-stretch">
  <aside class="shrink-0 order-last md:order-first">Sidebar (reordered on desktop)</aside>
  <main class="grow">Main content (fills remaining space)</main>
</div>

Alignment class reference

Container alignment

ClassPropertyValues
.justify-*justify-contentstart, end, center, between, around, evenly, normal, stretch
.justify-items-*justify-itemsstart, end, center, stretch
.items-*align-itemsstart, end, center, baseline, stretch
.content-*align-contentstart, end, center, between, around, evenly, stretch, normal

Item alignment

ClassPropertyValues
.justify-self-*justify-selfauto, start, end, center, stretch
.self-*align-selfauto, start, end, center, baseline, stretch

Shorthand alignment (grid)

ClassPropertyValues
.place-content-*place-contentstart, end, center, between, around, evenly, stretch
.place-items-*place-itemsstart, end, center, stretch
.place-self-*place-selfauto, start, end, center, stretch

Responsive prefix

All utilities on this page support {breakpoint}: prefixes:

html
<!-- Stack on mobile, row from md, centered from lg -->
<div class="flex flex-col md:flex-row lg:items-center gap-4">...</div>

<!-- Hidden on mobile, visible from md -->
<div class="hidden md:block">Desktop only</div>

<!-- Last on mobile, first from md -->
<div class="order-last md:order-first">Sidebar</div>

Breakpoints (min-width): sm 640px, md 768px, lg 1024px, xl 1280px, 2xl 1536px.


Comparison with Bootstrap

FeatureBootstrap 5Grundtone
Naming.justify-content-md-center (26 chars).md:justify-center (19 chars)
!importantOn every utilityNone — clean cascade
Flex + Grid alignmentSeparate utility setsUnified — same classes work on both
Column offsetsoffset-* (left only)col-start-* / col-end-* (both directions)
Place utilitiesNot availableplace-items, place-content, place-self
Justify-selfNot available.justify-self-*
Responsive visibility.d-md-none / .d-md-block.hidden / .md:block
Display switching.d-flex, .d-grid.flex, .grid