Chapter 13 of 15

Web Typography: Fonts That Are Easy to Read

Most of the web is text. Good typography makes text easier and more pleasant to read.

Font families

CSS
body {
  font-family: "Inter", Arial, sans-serif;
}

You give a list. If the first font is missing, the browser tries the next one. Always end with a general family:

The letters Ag in serif, sans-serif and monospace fonts
The three general font families. Always end your font list with one of them.
  • sans-serif: clean letters without small feet. Good for screens.
  • serif: small feet on the letters, like in newspapers.
  • monospace: every letter is the same width. Good for code.

The fastest font: system fonts

Every phone and computer already has good fonts installed. If you use them, there is nothing to download, so text appears instantly:

CSS
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

This shows San Francisco on Apple devices, Segoe UI on Windows and Roboto on Android. Each looks natural on its own device. Many big websites use this list.

Using Google Fonts

Google Fonts gives hundreds of free fonts. Pick one, copy the <link> code they give you, and put it in your <head>:

HTML
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
Load only what you useEvery extra font weight makes the page slower. Two fonts and two or three weights are enough for most sites. display=swap shows text at once while the font loads.

Host the font yourself

Loading fonts from Google is easy, but the browser must contact another server first. Putting the font files on your own site is often faster, and no visitor data goes to another company.

CSS
@font-face {
  font-family: "Inter";
  src: url("fonts/inter.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

Download the font in .woff2 format (the smallest), put it in a fonts folder, and add the code above. font-display: swap shows text in a backup font until yours is ready, so nobody waits for a blank page.

Four rules for readable text

CSS
body {
  font-size: 18px;      /* 1. not too small (16-20px) */
  line-height: 1.6;     /* 2. space between lines */
  color: #222;          /* 3. strong contrast */
}
article {
  max-width: 65ch;      /* 4. not too wide (about 65 letters) */
}
Result in the browser

This paragraph follows all four rules. The size is big enough, the lines have room to breathe, the colour is dark, and each line is short enough that your eyes can find the next line easily.

Top: long, tightly packed lines. Bottom: shorter lines with more space
Short lines with space between them are much easier to read.

ch is the width of the "0" letter, so 65ch is about 65 letters per line.

Font weights

Weights go from 100 (very thin) to 900 (very heavy). normal is 400 and bold is 700.

Result in the browser

Light 300 · Regular 400 · Semibold 600 · Extra bold 800

A font only shows the weights you load. If you ask for 600 but only loaded 400 and 700, the browser picks the nearest one. Load just the weights you use, usually two or three.

Letter spacing, capitals and alignment

CSS
h1 {
  letter-spacing: -0.02em;  /* big headings look better slightly tighter */
  text-wrap: balance;       /* even line lengths in headings */
}
.label {
  text-transform: uppercase;
  letter-spacing: 0.05em;   /* capitals need a little more space */
  font-size: 13px;
}
p { text-align: left; }
  • Use text-transform: uppercase only for short labels. Long text in capitals is hard to read.
  • text-wrap: balance stops a heading from leaving one lonely word on the last line.
  • Keep paragraphs aligned left. text-align: justify creates uneven gaps between words on the web.

Make a clear hierarchy

People scan before they read. Make headings clearly different from body text: bigger, bolder, more space above. Pick a few sizes, for example 16, 20, 28 and 40px, and reuse them.

A type scale with text at 40, 28, 20 and 16 pixels
Use a few clear sizes and repeat them on every page.
CSS
h1 { font-size: 2.5rem; font-weight: 800; line-height: 1.1; }
h2 { font-size: 1.75rem; font-weight: 700; margin-top: 2em; }
p  { margin-bottom: 1em; }
Avoid theseText in ALL CAPITALS for long sentences, light grey text on white, very thin fonts for body text, and centered long paragraphs. All are hard to read.

Mini project: style a blog post

CSS
:root { --text: #1f2937; --soft: #4b5563; }

article {
  max-width: 65ch;
  margin: 40px auto;
  padding: 0 16px;
  font: 18px/1.7 system-ui, sans-serif;
  color: var(--text);
}
article h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.1; margin: 0 0 12px; }
article h2 { font-size: 26px; margin: 2em 0 0.5em; }
article .meta { color: var(--soft); font-size: 15px; }
article blockquote {
  margin: 1.5em 0;
  padding-left: 16px;
  border-left: 4px solid #2563eb;
  color: var(--soft);
}

Write a short post with a title, a date line (class="meta"), two h2 sections and one quote. These few rules give it the calm feel of a good magazine page.

Common mistakes

MistakeBetter
Four or five different fontsOne or two fonts for the whole site
Body text 13 or 14px16 to 20px
Light grey text on whiteDark grey or black for body text
Lines across the full screen widthmax-width: 65ch
Loading every weight of a fontLoad only the two or three you use

Practice time

  1. Add one Google Font to your site.
  2. Set body text to 18px with line-height 1.6.
  3. Limit your article width to 65ch.
  4. Try the system font list on your site and compare the speed with a Google Font.
  5. Style a blog post using the project code.

Quick summary

  • Give a font list ending with sans-serif or serif.
  • 16 to 20px text, 1.5 to 1.7 line height, ~65 letters per line.
  • Few fonts, few sizes, strong contrast.