Layout
Spacing and positioning defaults for arranging components on a page.
These rules cover how components sit together on a page. They are defaults, not a checklist; see the Guidelines overview for how to apply them.
Spacing
- Leave at least twice as much space between groups as between items in a
group (e.g.
8pxbetween items,16pxor more between groups).
Small screens
- Design for a
390pxwide phone. Nothing should make the page scroll sideways. - Let text wrap rather than scroll. Add
wrap-anywhere(Tailwind) to table cells, inline code, and any flex child that holds a long word, address, or identifier.break-wordsis not enough there: a table cell or flex item still sizes to its longest word. - Let a code block wrap with
whitespace-pre-wrap wrap-anywhere. If horizontal scrolling is the better fit for the code, useoverflow-x-autowith the fade from Interface, and keep the scroll inside the block so the page itself doesn't widen. - Make a table fit by wrapping its cells. For a table with many columns,
stack each row as a labelled group below the
smbreakpoint instead.
Do
Put whitespace-pre-wrap wrap-anywhere on a pre, and wrap-anywhere on
each td, so a 42-character address breaks inside its cell.
Don't
Leave a raw pre, inline code, or table unstyled. Each is as wide as
its longest unbroken line and pushes the page past the screen.
Anchors
- Use
scroll-margin-topto leave space above headings that are link targets, so they aren't hidden under sticky headers.