Layout recipes

Four useful starting structures, adapted to the content rather than a device list.

Documentation

Use a readable main column, named navigation, clear page hierarchy and an optional in-page index. Move the sidebar into a labelled disclosure when the content needs the width. Keep direct links, search and a useful missing-page route.

Forms

Keep label, control, help and error together. Use fieldsets for related choices and a focused error summary for multiple failures. Stack actions where their labels need the space. A modal is appropriate for a bounded task; substantial forms usually deserve a page.

Collections

Choose rows or cards by the relationships between objects. Align metadata and keep selection distinct from opening details. Wrap a long heading to a full line when a large selection target leaves too little space.

Data views

Keep comparison tables semantic and allow a named region to scroll when columns genuinely need width. Filtering and pagination remain outside that scroll region. Offer the exact data behind a chart as text or a table.

Adapt without losing the task

  • Use content-led breakpoints, including a check immediately on each side of a layout change.
  • Allow flex/grid items to shrink with min-inline-size: 0 and minmax(0, 1fr); wrap useful text rather than hiding overflow.
  • Bound nested gutters before shrinking text or targets. Keep the modal’s outer clearance and reduce inner padding where necessary.
  • Reserve intrinsic media and known asynchronous copy naturally; avoid hard-coded text heights.
  • Check a short viewport, keyboard reachability, software keyboard, safe areas, left and right edges, and actual word readability.