What You'll Learn
You'll learn how to create a library of reusable CSS classes that handle typography systematically, making text styling consistent and fast across your entire site.
The Core Idea
Think of typographic utility classes like a spice rack in your kitchen. Instead of mixing custom seasonings every time you cook, you reach for pre-measured, labeled bottles. Similarly, instead of writing font-size: 1.25rem; font-weight: 600; repeatedly, you apply a class like .text-lg-semibold and you're done.
Utility classes are small, single-purpose CSS rules that you combine directly in your HTML. For typography, this means creating classes for:
- Text sizes (
.text-sm,.text-base,.text-lg) - Font weights (
.font-normal,.font-semibold,.font-bold) - Text styles (
.italic,.uppercase) - Text alignment (
.text-left,.text-center,.text-right)
The power comes from composition—mixing and matching these classes as needed rather than creating custom styles for every component.
Building Your Utility System
Start by defining classes that match your type scale and font weight scale from earlier lessons:
/* Sizes from your type scale */
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
/* Weights from your weight scale */
.font-normal { font-weight: 400; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
/* Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
/* Style */
.italic { font-style: italic; }
.uppercase { text-transform: uppercase; }
Now in HTML, you compose: <p class="text-lg font-semibold text-center">.
Key Takeaway: Typographic utility classes create a reusable design language that speeds up development and enforces consistency by breaking typography into composable, single-purpose classes.