Skip to main content
Albero Academy

Typography & Web Fonts

Make text look great — font properties, loading custom web fonts, controlling line-height and spacing, and readable text layout.

Chapter 8CSS15 min readBeginner friendly
  • #CSS
  • #Typography
  • #Fonts

Typography is most of what makes a page feel polished — the majority of any design is text. CSS gives you fine control over fonts, size, weight and spacing. Get the defaults right (readable size, comfortable line-height, a good font stack) and everything looks more professional.

Font properties

the essentials
.body {
font-family: Inter, system-ui, sans-serif;
font-size: 1rem; /* 16px — respects user zoom (use rem) */
font-weight: 400; /* 400 normal, 600 semibold, 700 bold */
font-style: italic;
line-height: 1.6; /* unitless = 1.6× the font size */
letter-spacing: -0.01em;
}

Font stacks & web fonts

A font stack lists fallbacks so text always renders. To use a custom font, either link it (Google Fonts) or self-host with @font-face:

loading a font
/* Self-hosted with @font-face */
@font-face {
font-family: "Inter";
src: url("/fonts/inter.woff2") format("woff2");
font-weight: 100 900; /* a variable font covers a range */
font-display: swap; /* show fallback text while it loads */
}
body { font-family: Inter, system-ui, sans-serif; }

Line-height & spacing

  • Use a unitless line-height (1.5–1.7 for body) so it scales with the font size.
  • Limit line length for readability — around 60–75 characters, via max-width: 65ch.
  • letter-spacing tightens large headings; leave body text alone.

Styling text

text properties
text-align: center; /* left | right | center | justify */
text-transform: uppercase; /* also capitalize | lowercase */
text-decoration: underline; /* also line-through | none */
white-space: nowrap; /* prevent wrapping */
text-overflow: ellipsis; /* … for clipped text (with overflow:hidden) */

Practice

Set a readable body type: a good font stack, 1rem size, 1.6 line-height and a max-width of 65ch on paragraphs. Load one web font with @font-face and font-display: swap, and style a heading with tighter letter-spacing.

Key takeaways

  1. 01Core font properties: font-family, font-size (in rem), font-weight, font-style, line-height, letter-spacing.
  2. 02Use a font stack with fallbacks; load custom fonts via a link or @font-face.
  3. 03Always set font-display: swap so text shows in a fallback while the font loads.
  4. 04Unitless line-height (1.5–1.7) scales with size; cap line length at ~65ch for readability.
  5. 05text-align/transform/decoration and text-overflow: ellipsis control text presentation.