liveBook · Manning

Margin

As explained in Design for Developers

A margin is the empty space separating a layout element from adjacent elements or the containing boundary.

Margin is empty space that separates an element from nearby content or a containing boundary. In typography, it helps keep text aligned to a consistent vertical rhythm instead of treating spacing as an arbitrary visual choice. section 10.5 section 6.2.2

Use margin to make spacing decisions consistent and readable:

  • Choose a baseline unit, such as 12px, then calculate margins and padding from that rhythm. section 10.5
  • Adjust margin when line-height changes so the combined dimensions still align with the baseline grid. section 10.5
  • Define the margin between grid columns alongside the container width and number of columns. section 6.2.2

Aligning body copy

With a 16px body font and a 1.25 line-height, each line is 20px high. Adding 16px of top margin makes the combined 36px align with the chosen rhythm, while also separating paragraphs from surrounding content. section 10.5

How Design for Developers covers it

How deep it goes
Calculates margins from font size, line height, and baseline units, then applies them to headings, paragraphs, and grid columns.
Examples
Uses a 16px paragraph margin, type-specific top margins, and a 1200px grid with 22px outer margins and 20px column gaps.
What it assumes
Builds from basic font size and line-height choices before applying margin to typography and grids.
What you can do after
Apply it via baseline calculations to tune text spacing and define consistent grid relationships.
How it connects
Connects margin to vertical rhythm, typography, line height, padding, grid systems, and CSS Grid.

Also explained in

Compare how 2 books explain margin →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Design for Developers. The section links point to the parts of the book it draws on.