LEGACY Tailwind CSS v3-era example, archived unchanged. Kept for reference only — it uses the v3 Play CDN and JS config, both removed in v4. Current documentation →

Tailwind CSS Typography

Master the art of creating beautiful and readable text layouts with Tailwind's utility-first approach

What is Tailwind CSS Typography?

Typography in Tailwind CSS provides a comprehensive set of utilities for styling text content, enabling you to create visually appealing and readable layouts with minimal effort. These utilities control font families, sizes, weights, line heights, colors, and more.

Tailwind makes it easy to apply consistent typography styles across your project, improving readability and visual hierarchy - key components of effective UI design.

Key Features

  • Font family, size and weight
  • Text colors and alignment
  • Line height and letter spacing
  • Text decoration and transformation

Pro Tip: Combine typography utilities with responsive prefixes (like md:text-lg) to create designs that adapt perfectly to different screen sizes.

Font Family

Font families define the overall character of your text. Tailwind provides three base font family utilities:

font-sans: Modern, clean UI font (default)

font-serif: Traditional, authoritative look

font-mono: Monospaced for code displays

Use cases: Use sans-serif for UI elements and body text, serif for headings or formal content, and monospace for code snippets or technical documentation.

Font Size

Control text size with responsive utilities ranging from tiny to extra large:

text-xs (12px)

text-sm (14px)

text-base (16px)

text-lg (18px)

text-xl (20px)

text-2xl (24px)

Use cases: Establish visual hierarchy with larger sizes for headings and smaller sizes for captions or secondary information. The responsive variants allow text to adapt to different screen sizes.

Font Weight

Adjust text thickness to create emphasis or reduce visual prominence:

font-light: Lighter than normal text

font-normal: Default text weight

font-medium: Slightly bolder than normal

font-semibold: Semi-bold emphasis

font-bold: Strong emphasis

Use cases: Use font weights to create visual hierarchy without changing font size. Bold and semibold weights are excellent for headings or to highlight important information.

Letter Spacing

Control the space between characters for improved readability or style:

tracking-tight: Closer letter spacing

tracking-normal: Default letter spacing

tracking-wide: Wider letter spacing

Use cases: Tighter tracking works well for large headlines, while wider tracking can improve readability for all-caps text and improve the appearance of sparse characters.

Text Alignment

Control how text aligns horizontally within its container:

text-left: Align text to the left (default)

text-center: Center align text

text-right: Align text to the right

Use cases: Left alignment is best for most paragraph text, center alignment works well for headings or short pieces of text, and right alignment can be useful for timestamps or secondary information.

Text Decoration

Add lines to text for emphasis or style:

underline: Underlined text

line-through: Strikethrough text

overline: Line above text

no-underline: Remove text decoration

Use cases: Use underline for links (though this is often handled by link styling), strikethrough for deleted content or discounted prices, and no-underline to remove default underlines from links.

Decoration Style & Offset

Customize the appearance and position of text decorations:

decoration-solid

decoration-dotted

decoration-dashed

decoration-wavy

underline-offset-4

Use cases: Different decoration styles can enhance the visual appeal of links or headings. Adjusting offset can improve readability by preventing decorations from overlapping with descenders in text.

Text Transform

Control the capitalization of text:

normal-case: Text as entered

uppercase: ALL CAPS

lowercase: all lowercase

capitalize: First Letter Of Each Word

Use cases: Use uppercase for headings, buttons, or labels to create visual impact. Lowercase can soften text, while capitalize works well for titles and proper nouns.

Typography Best Practices

  • Readability: Prioritize readability over aesthetics. Use appropriate font sizes and line heights.
  • Contrast: Ensure sufficient contrast between text and background colors.
  • Consistency: Maintain consistent typography across your application.
  • Hierarchy: Establish clear visual hierarchy using font size, weight, and color.
  • Responsive design: Use Tailwind's responsive prefixes (sm:, md:, lg:) to adjust typography for different screen sizes.

Typography is both an art and a science—these utilities provide the technical tools, but thoughtful application is what creates truly effective designs.

Typography Examples

Font Family

The quick brown fox (font-sans)

font-sans

The quick brown fox (font-serif)

font-serif

The quick brown fox (font-mono)

font-mono

Font Weight

Font Light

font-light

Font Normal

font-normal

Font Medium

font-medium

Font Semibold

font-semibold

Font Bold

font-bold

Text Alignment

This text is left-aligned.

text-left

This text is center-aligned.

text-center

This text is right-aligned.

text-right

Font Size

text-xs: Small text

text-sm: Slightly small text

text-base: Base text size

text-lg: Larger text

text-xl: Extra large

text-2xl: 2xl size

text-3xl: 3xl size

Text Decoration

Underlined

underline

Strikethrough

line-through

Dotted

decoration-dotted

Dashed

decoration-dashed

Wavy

decoration-wavy

Offset

underline-offset-4

Text Transform

This text is uppercase.

uppercase

THIS TEXT IS LOWERCASE.

lowercase

this text is capitalized.

capitalize

Summary & Key Takeaways

What We've Learned

  • Typography is a crucial element for creating visually appealing and readable interfaces
  • Tailwind provides utilities for font families, sizes, weights, spacing and more
  • Using consistent typography creates visual harmony in your design system
  • Responsive typography utilities help create adaptive text layouts

Next Steps

  • Create a typography system with consistent sizing and spacing ratios
  • Experiment with combining typography utilities for unique text styles
  • Use responsive prefixes to adapt your typography to different screen sizes
  • Check out the official Tailwind CSS documentation for more details