Utility classes for spacing, sizing, display, flexbox, text, colour, borders, and more.
Most ship from @keenmate/pure-css; the rest from core. For heights in real
layouts see Sizing & Layout, for text styles
Typography, for the 1–9 colour slots
Colors.
Spacing - Margin & Padding
Two scales
| Scale | Steps | Values |
|---|---|---|
| Numeric | 0–6, 8, 10, 12, 16, 20 (no 7, 9, 11…) |
0 / .25 / .5 / .75 / 1 / 1.25 / 1.5 / 2 / 2.5 / 3 / 4 / 5 rem |
| Semantic | 0, xs, sm, md, base, lg, xl, 2xl |
0 / .4 / .8 / 1.2 / 1.6 / 2.4 / 3.2 / 4.8 rem |
Sides
| Sides | Margin | Padding | Scales |
|---|---|---|---|
| All / axis | m-*, mx-*, my-* |
p-*, px-*, py-* |
numeric + semantic |
| Top / bottom | mt-*, mb-* |
pt-*, pb-* |
numeric + semantic |
| Start / end | ms-*, me-* |
ps-*, pe-* |
numeric + semantic |
Horizontal sides are start / end: they follow the writing
direction, so under dir="rtl" the spacing mirrors with the layout
(ms-* is the left in LTR, the right in RTL). There are no
ml-* / mr-* / pl-* / pr-* classes.
Auto Margins
m-auto, mx-auto, my-auto, mt-auto, mb-auto,
ms-auto, me-auto
Live Examples
ms-auto pushes an item to the end of a flex row (the start in RTL):
Semantic padding:
Gap Utilities
For flex and grid containers. Same two scales as spacing.
| Scale | Both axes | Columns only | Rows only |
|---|---|---|---|
| Semantic | gap-{0|xs|sm|md|base|lg|xl|2xl} |
column-gap-* |
row-gap-* |
| Numeric | gap-{0-6|8|10|12|16|20} |
gap-x-* |
gap-y-* |
Live Example
gap-xs
gap-md
column-gap-xl row-gap-xs (wrapping)
Width Utilities
| Type | Width | Min-width | Max-width |
|---|---|---|---|
| Percent (5% steps) | w-{5-100}, w-auto |
minw-{5-100} |
maxw-{5-100} |
| Fraction | w-{1-2|1-3|2-3|1-4|3-4} |
minw-{1-3|2-3} |
maxw-{1-2|1-3|2-3|1-4|3-4} |
| REM | wr-{1-10}, then wr-{15|20|…|50} |
minwr-* (same steps) |
maxwr-* (same steps) |
| Fixed (min-width + width) | w-{25|50|75|100}-fixed — won't shrink below its width in a flex row |
||
Live Example
Height Utilities
| Type | Height | Min-height | Max-height |
|---|---|---|---|
| Percent | h-{25|50|75|100}, h-auto |
minh-{5-100} (5% steps) |
maxh-{5-100} (5% steps) |
| Fraction | h-{1-2|1-3|2-3|1-4|3-4} |
minh-{1-2|1-3|2-3|1-4|3-4} |
maxh-{1-2|1-3|2-3|1-4|3-4} |
| REM | hr-{1-10}, then hr-{15|20|…|50} |
minhr-* (same, plus 60|70|80|90|100) |
maxhr-* (same steps as hr-*) |
| Viewport / parent | h-full, h-screen |
min-h-full, min-h-screen |
max-h-full, max-h-screen |
Percent heights only work when the parent has a height.
Full-height layouts, scrollable regions and minhr-* in context are on
Sizing & Layout.
Live Example
Display Utilities
Classes: d-none, d-inline, d-inline-block, d-block, d-flex, d-inline-flex
Live Example
d-inline vs d-block:
Flexbox Utilities
| Category | Classes |
|---|---|
| Direction & Wrap | flex-row, flex-column, flex-wrap, flex-nowrap |
| Justify Content | justify-content-{start|end|center|between|around} |
| Align Items | align-items-{start|end|center|baseline|stretch} |
| Align Self | self-{start|center|end|stretch|baseline} |
| Flex shorthand | flex-1 (grow from 0), flex-auto (grow from content), flex-initial (shrink only), flex-none (rigid), flex-fill |
| Grow / Shrink | flex-grow, flex-grow-{0|1}, flex-shrink, flex-shrink-{0|1} |
Live Examples
justify-content-between:
flex-none + flex-1 + flex-none:
align-items-center with different heights:
Text & Font Utilities
| Category | Classes |
|---|---|
| Alignment | text-start, text-center, text-end |
| Wrapping | text-nowrap, text-truncate |
| Size | text-{2xs|xs|sm|md|base|lg|xl|2xl|3xl|4xl} |
| Colour | text-body (main), text-muted (muted), text-{primary|success|danger|warning|info} |
| Weight | font-weight-{normal|medium|semibold|bold} (400 / 500 / 600 / 700) |
| Style | font-style-{normal|italic} |
| Family | font-family-{system|sans|serif|mono} |
| Vertical text | text-vertical (reads top → bottom), text-vertical-up (bottom → top) |
Live Examples
Role Colour Utilities
The six roles: primary, secondary, success,
danger, warning, info. The same three families exist for the
1–9 colour slots (bg-color-N, surface-color-N, text-on-color-N)
— see Colors.
| Class | Sets | Use |
|---|---|---|
surface-{role} |
background + readable text | Coloured blocks — the default choice |
bg-{role} |
background only | When the text colour is handled separately |
text-on-{role} |
text only (the readable colour on that role) | Pair with bg-{role}, or for text on a role-coloured parent |
Live Example
Overflow & Cursor Utilities
Overflow
overflow-{auto|hidden|visible}, overflow-{x|y}-auto
overflow-overlay, overflow-{x|y}-overlay — the scrollbar floats
over the content instead of taking width (Chromium; elsewhere falls back to auto)
Cursor
Hover to see cursor change:
Position & Border Utilities
| Category | Classes |
|---|---|
| Position | position-{static|relative|absolute|fixed|sticky} |
| Border (add) | border, border-top, border-bottom, border-start, border-end |
| Border (remove) | border-0, border-top-0, border-bottom-0, border-start-0, border-end-0 |
| Border style | border-{solid|dashed|dotted|none} |
| Radius | rounded, rounded-lg, rounded-circle, rounded-0 |
| Radius (sides) | rounded-top, rounded-bottom, rounded-start, rounded-end |
Start / end follow the writing direction like the logical spacing,
so they mirror under dir="rtl". There are no -left / -right variants.
Live Examples
Shadow Utilities
Classes: shadow-none, shadow-sm, shadow, shadow-lg
Miscellaneous
| Class | What it does |
|---|---|
rotate-{90|180|270} |
Rotates the element (the box stays horizontal — for a narrow vertical label use text-vertical) |
unstyled |
On a <ul> / <ol>: no bullets, no indent |
compact-mode |
On a container (or <body>): tighter card bodies, table cells, sidebar links and form groups |
font-size-{small|default|large|xlarge} |
On <html>: scales the whole UI (9 / 10 / 11 / 12px root). Responsive variant:
pa-font-base-N + pa-font-mobile-N, or pa-font-responsive.
See Getting Started. |
Live Example
- unstyled list
- no bullets
CSS Classes Reference
Spacing (Margin & Padding)
m-{0-6|8|10|12|16|20},p-*— Numeric scale (0.25rem steps, rem)m-{0|xs|sm|md|base|lg|xl|2xl},p-*— Semantic scalemt-*,mb-*,mx-*,my-*(andpequivalents) — Sides / axes, both scalesms-*,me-*,ps-*,pe-*— Start / end (mirror under RTL), both scalesm-auto,mx-auto,my-auto,mt-auto,mb-auto,ms-auto,me-auto— Auto margins
Gap
gap-{0|xs|sm|md|base|lg|xl|2xl},row-gap-*,column-gap-*— Semanticgap-{0-6|8|10|12|16|20},gap-x-*,gap-y-*— Numeric
Width
w-{5-100}(5% steps),w-auto,w-{1-2|1-3|2-3|1-4|3-4}minw-{5-100},minw-{1-3|2-3},maxw-{5-100},maxw-{1-2|1-3|2-3|1-4|3-4}wr-,minwr-,maxwr-{1-10|15|20|25|30|35|40|45|50}— REMw-{25|50|75|100}-fixed— Fixed width (min-width + width)
Height
h-{25|50|75|100|auto},h-{1-2|1-3|2-3|1-4|3-4}minh-,maxh-{5-100}(5% steps) and fractionshr-,maxhr-{1-10|15|20|25|30|35|40|45|50},minhr-(same +60|70|80|90|100) — REMh-full,h-screen,min-h-{full|screen},max-h-{full|screen}
Display
d-none,d-block,d-inline,d-inline-block,d-flex,d-inline-flex
Flexbox
flex-row,flex-column,flex-wrap,flex-nowrapjustify-content-{start|end|center|between|around}align-items-{start|end|center|baseline|stretch},self-{start|center|end|stretch|baseline}flex-{1|auto|initial|none|fill},flex-grow,flex-grow-{0|1},flex-shrink,flex-shrink-{0|1}
Text & Font
text-{start|center|end},text-nowrap,text-truncatetext-{2xs|xs|sm|md|base|lg|xl|2xl|3xl|4xl}— Font sizetext-body,text-muted(muted),text-{primary|success|danger|warning|info}font-weight-{normal|medium|semibold|bold},font-style-{normal|italic},font-family-{system|sans|serif|mono}text-vertical,text-vertical-up
Colour
surface-{role},bg-{role},text-on-{role}— role = primary|secondary|success|danger|warning|infosurface-color-N,bg-color-N,text-color-N,text-on-color-N,border-color-N— Colour slots 1–9 (see Colors)
Overflow & Cursor
overflow-{auto|hidden|visible},overflow-{x|y}-auto,overflow-overlay,overflow-{x|y}-overlaycursor-{pointer|help|wait|not-allowed|text|move|default|grab|grabbing|zoom-in|zoom-out}
Position & Border
position-{static|relative|absolute|fixed|sticky}border,border-{top|bottom|start|end},border-0,border-{top|bottom|start|end}-0border-{solid|dashed|dotted|none}rounded,rounded-lg,rounded-circle,rounded-0,rounded-{top|bottom|start|end}
Shadow & Misc
shadow-none,shadow-sm,shadow,shadow-lgrotate-{90|180|270},unstyled(lists),compact-mode,html.font-size-*