Spacing

A 4px grid and the Tailwind spacing scale.

Every gap, padding, and margin is a multiple of 4px — Tailwind's default --spacing: 0.25rem. Reach for the steps below; anything in between is a smell.

14px
28px
312px
416px
624px
832px
1248px
1664px
2496px

Layout

UseValue
Inside controlspx-2.5–px-3 (10–12px)
Inside cards and panelsp-4–p-6 (16–24px)
Between related itemsgap-2–gap-3
Between groupsgap-6–gap-8
Between page sectionspy-16–py-24
Page gutterpx-4 on phones, px-6 from md
Content widthmax-w-6xl for apps, max-w-3xl for reading
  • Do use gap on flex and grid parents instead of margins on children.
  • Do let density follow context: tighter in tables and menus, looser on marketing pages.

On this page