Web typography: fonts, size and spacing

Beginner  Nov 3, 2026

Make text easy to read before making it pretty.

Web typography: fonts, size and spacing
The steps of this tutorial at a glance.
The steps of this tutorial at a glance.

Pick fonts

Use one font for headings and one for body text, or just one family. Too many fonts look messy and slow the page.

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

System fonts load instantly and look native on each device.

How the code in this section fits into the page.
How the code in this section fits into the page.

Readable size and width

  • Body text: 16px (1rem) or more.
  • Line height: 1.5 to 1.7 for paragraphs.
  • Line length: about 45 to 75 characters.
.article { max-width: 65ch; }
The main points of this section.
The main points of this section.

Hierarchy

Headings should be clearly bigger or bolder than body text, with more space above than below, so each heading belongs to the text under it.

Hierarchy
Hierarchy

Using a web font

@font-face {
  font-family: "Inter";
  src: url("fonts/inter.woff2") format("woff2");
  font-display: swap;
}
body { font-family: "Inter", system-ui, sans-serif; }

font-display: swap shows text immediately with a fallback font, and swaps when the web font is ready.

Tip

Always include a fallback list (system-ui, sans-serif), and check the licence of any font you use.

More tutorials