CSS - Text
Overview
Quick links: Exercises • Checks • Print as PDF
Estimated time: 12–18 minutes
Text properties shape typography and readability. Learn the essentials for clear and consistent content styling.
Learning Objectives
- Control alignment, decoration, and transformations.
- Manage spacing and wrapping for readable text blocks.
- Use hyphenation and overflow handling.
Details & Examples
text-align,text-decoration,text-transformletter-spacing,word-spacing,line-heighthyphens,overflow-wrap,white-space
.title { text-transform: uppercase; letter-spacing: .05em; }
.note { text-decoration: underline wavy; }
.readable { line-height: 1.6; max-width: 65ch; }
.break-words { overflow-wrap: break-word; }
Try it
Common Pitfalls
- Setting
line-heighttoo small hurts readability. - Overusing uppercase reduces scannability.
Checks for Understanding
- What’s a good starting range for paragraph
line-height? - How do you enable hyphenation?
Show answers
- 1.5–1.7 depending on font.
hyphens: auto;and a properlangattribute.
Exercises
- Style a body of text to be highly readable: limit width with ch units, set line-height, and adjust letter-spacing for headings.
- Demonstrate hyphenation and overflow-wrap behavior with a long compound word.
Suggested answers
max-width: 65ch; line-height: 1.6;and for headingsletter-spacing: .02em;hyphens: auto;withlangattribute;overflow-wrap: break-word;for long words