Text and fonts

Readable type: font stacks, size, line height and line length.

Most of a website is text, so good type does more for a design than any decoration.

CSS
body {
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}
h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

A font stack lists fallbacks, so the page still looks fine if the first font is missing. Always end with a generic family such as sans-serif.

  • Line height of about 1.5 to 1.7 suits body text.
  • Keep lines to roughly 60 to 75 characters: max-width: 65ch does this neatly.
  • Check contrast. Grey text on a white background is a common accessibility failure.
Edit the CSS
Preview
โ† The box modelDisplay and position โ†’