devnotes.

Typography Basics

Typography properties control how text renders — font choice, size, weight, spacing, and alignment.

body {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.01em;
  text-align: left;
}

h1 {
  font-weight: 700;
  text-transform: uppercase;
}
  • font-family — lists fonts in order of preference; the browser uses the first one it has available, falling back to the next. Always end the list with a generic family (serif, sans-serif, monospace) as a final safety net.
  • font-weight — numeric values (400 = normal, 700 = bold) give finer control than the keywords normal/bold, especially for variable fonts with many weight steps.
  • line-height — the vertical space a line of text occupies. Unitless values (like 1.6) are generally preferred over px, since they scale proportionally with the element's own font size.
  • letter-spacing — adjusts spacing between characters; small positive values can improve readability for all-caps text.
  • text-align — controls horizontal alignment (left, center, right, justify).

Web fonts (fonts not installed on the user's device) are loaded with @font-face or a service like Google Fonts:

<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
body {
  font-family: "Inter", sans-serif;
}

Good typography defaults — comfortable line-height, a readable font-size (16px minimum for body text), and adequate contrast against the background — matter more for readability than an unusual font choice.