Lesson 8 of 50
cssTypography Basics
10 mins
Course progress16%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 8 of 50
css10 mins
Keep these ideas in mind as you work through the lesson.
Good typography is the backbone of readability and brand identity. CSS gives you fine‑grained control over how text appears on every device.
| Property | What it Controls |
|---|---|
font-family | Stack of fallback fonts. |
font-size | Size of the glyphs. |
font-weight | Thickness (normal, bold, numeric 100‑900). |
line-height | Space between lines – expressed as unitless number, percent, or length. |
letter-spacing | Horizontal spacing between characters (tracking). |
word-spacing | Space between words. |
text-align | Horizontal alignment (left, right, center, justify). |
text-decoration | Underline, line‑through, overline. |
text-transform | Upper‑/lower‑case conversion. |
font-variant / font-feature-settings | OpenType features like ligatures, small‑caps. |
clamp()html {
/* fluid type that never goes below 14px or above 18px */
font-size: clamp(14px, 1vw + 1rem, 18px);
}
body { line-height: 1.6; }
clamp(min, preferred, max)lets you define a fluid range that automatically adapts to the viewport while staying within sensible limits.
body {
font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
The first available font is used. If none of the custom fonts load, the system fallbacks keep the layout readable.
rem for All SpacingWhen the root html font‑size is the single source of truth, you can resize the whole UI by changing just one value (great for accessibility and design‑system scaling).