Text Styling

๐ŸŽจ CSS3+ ๐ŸŸข Chapter 17 of 49 ๐Ÿ“‚ Phase 06: Typography ๐Ÿ“… 2026 Edition
๐Ÿ“Œ Covered in this chapter: font-size ยท line-height ยท letter-spacing ยท word-spacing ยท text-align ยท text-decoration ยท text-transform ยท text-indent ยท text-shadow ยท white-space ยท text-overflow ยท ellipsis ยท Readability ยท Typography Scale
Welcome to Chapter 17: Text Styling โ€” part of the CSS Complete Roadmap. This lesson covers all subtopics with clear explanations, code examples, and best practices used in professional web development.
1Font Size, Line Height & Spacing
CSS โ€” Readable Textโ–ถ Try in Editor
.description {
  max-width: 65ch;
  line-height: 1.6;
  color: #4b5563;
  font-size: 1rem;
  letter-spacing: 0.01em;
  word-spacing: normal;
}

Readability: Body text line-height: 1.5โ€“1.7, max width 65ch, sufficient contrast.

2Text Alignment, Decoration & Transform
CSS
h1 { text-align: center; text-transform: capitalize; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.label { text-transform: uppercase; letter-spacing: 0.05em; }
.quote { text-indent: 2rem; }
3Text Shadow, White Space & Ellipsis
CSS
.hero-title {
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preserve {
  white-space: pre-wrap;
}
4Typography Scale
CSS โ€” Type Scale
:root {
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
}

Consistent modular scale โ€” design system lo headings and body harmonious ga untayi.

OC
Written by Our Compiler Technical Editorial Team
Reviewed for accuracy ยท CSS Complete Roadmap ยท Last updated August 2026