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
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:
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:
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>:
<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">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.
@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
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) */
}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.
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.
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
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: uppercaseonly for short labels. Long text in capitals is hard to read. text-wrap: balancestops a heading from leaving one lonely word on the last line.- Keep paragraphs aligned left.
text-align: justifycreates 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.
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; }Mini project: style a blog post
: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
| Mistake | Better |
|---|---|
| Four or five different fonts | One or two fonts for the whole site |
| Body text 13 or 14px | 16 to 20px |
| Light grey text on white | Dark grey or black for body text |
| Lines across the full screen width | max-width: 65ch |
| Loading every weight of a font | Load only the two or three you use |
Practice time
- Add one Google Font to your site.
- Set body text to 18px with line-height 1.6.
- Limit your article width to
65ch. - Try the system font list on your site and compare the speed with a Google Font.
- 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.