TutreNews Learn

Box model, units and text

Text and fonts

Goal: Style readable text with font, size, weight, line-height and alignment · 9 min

Good typography makes pages readable.

propertypurposeexample
font-familytypeface, with fallbacksfont-family: "Open Sans", Arial, sans-serif;
font-sizesizefont-size: 1rem;
font-weightboldnessfont-weight: 700; (bold) or 400 (normal)
font-styleitalicfont-style: italic;
line-heightline spacingline-height: 1.5; (unitless: times the font size)
text-alignalignmentleft, center, right, justify
text-decorationunderline etc.none, underline
text-transformcaseuppercase, capitalize
letter-spacingtracking0.05em

Font stacks list fallbacks in order, ending with a generic family (serif, sans-serif, monospace). The browser uses the first one that is installed or loaded. Names with spaces need quotes.

Readability rules of thumb: body text 16–18px (1rem or more), line-height 1.4–1.6, line length of about 45–75 characters (max-width: 65ch), enough contrast, and never use colour alone to carry meaning.

body { font-family: system-ui, sans-serif; line-height: 1.6; }
article { max-width: 65ch; }

Worked example: A readable article

  1. Choose a font stack: system-ui, then sans-serif.
  2. Set font-size: 1.125rem and line-height: 1.6 for comfortable reading.
  3. Limit the line length with max-width: 65ch.
article {
  font-family: system-ui, sans-serif;
  font-size: 1.125rem;
  line-height: 1.6;
  max-width: 65ch;
}