Course contentsShow
← Web Development
Lesson 620 of 2,98211. Utility-First CSS with TailwindFree lesson

Typography Utilities: Font Family, Size, and Weight

Apply text-*, font-*, and leading-* utilities for complete typographic control without custom CSS.

Typography Utilities: Font Family, Size, and Weight

You'll learn how to control font styling in Tailwind CSS using utility classes instead of writing custom CSS rules.

The Core Idea

In traditional CSS, you'd write rules like font-family: Arial, font-size: 24px, or font-weight: bold for every element. Tailwind provides pre-built utility classes that apply these properties directly in your HTML, making typography changes visual and instant.

Think of it like ordering from a menu instead of cooking from scratch—the options are ready to use, consistently named, and require no custom recipe.

The Three Key Utility Groups

Font Family (font-*)

Tailwind includes font family utilities based on your theme configuration:

  • font-sans — applies your sans-serif stack
  • font-serif — applies your serif stack
  • font-mono — applies your monospace stack

Font Size (text-*)

Size utilities follow a predictable scale:

  • text-xs, text-sm, text-base, text-lg, text-xl
  • text-2xl through text-9xl for larger headings

Each includes both font-size and appropriate line-height automatically.

Font Weight (font-*)

Weight utilities map to CSS values:

  • font-thin (100), font-light (300), font-normal (400)
  • font-medium (500), font-semibold (600), font-bold (700)
  • font-extrabold (800), font-black (900)

Example Usage

<h1 class="font-serif text-4xl font-bold">Main Heading</h1>
<p class="font-sans text-base font-normal">Body paragraph text.</p>
<code class="font-mono text-sm font-medium">console.log('code')</code>

No custom CSS needed—every typographic decision is visible in the markup.

Key Takeaway: Tailwind's font-*, text-*, and leading-* utilities give you complete typographic control through composable classes, eliminating the need for custom font styling rules.