Tailwind CSS Typography

Tailwind CSS provides an extensive set of typography utilities for controlling everything from font-size and color to line-height and letter-spacing.

Tailwind's typography system is highly consistent, ensuring that text elements across your application maintain a professional and readable rhythm. Because typography encompasses so many CSS properties, it's not practical to list every single utility class. Instead, this page outlines the core concepts and provides examples of the most common text-related utilities to show you how they work together.

Font Family

Out of the box, Tailwind provides three default font families: a sans-serif stack (font-sans), a serif stack (font-serif), and a monospaced stack (font-mono). You can easily customize these defaults or add your own web fonts (like Google Fonts) in your project's configuration.

Font Size

You can use text-{size} to control the font size. Tailwind provides a comprehensive scale ranging from very small captions (text-xs) to massive hero headlines (text-9xl). The table below showcases some of the most commonly used sizes to give you an idea of the scale:

Class Size Example CSS
text-xs 0.75rem (12px) font-size: 0.75rem;
text-base 1rem (16px) Default browser size.
text-xl 1.25rem (20px) font-size: 1.25rem;
text-4xl 2.25rem (36px) Large heading.
text-9xl 8rem (128px) Hero-sized text.

Font Weight & Style

You can control the heaviness of your text using font weight utilities. Tailwind maps these utilities to the standard numeric weights (100 through 900) supported by most modern variable fonts.

Class Weight
font-thin, font-light 100, 300
font-normal, font-medium 400, 500
font-bold, font-extrabold 700, 800
font-black 900

You can also use italic and not-italic to control the font style.

Text Alignment & Wrapping

Managing how text flows within its container is important for readability:

Color & Decoration

Visual style is also important when it comes to typography:

Leading & Tracking

You can control the line-height (leading) and letter-spacing (tracking) to fine-tune readability.

Leading (Line Height)

Modern Tailwind prefers the combined shorthand or the numeric scale. While some aliases like leading-tight, leading-snug, leading-normal, leading-relaxed and leading-loose exist, they're considered deprecated in favour of using numbers offers better precision within your design grid.

Format Example Class Description
Combined text-base/7 Sets font-size and line-height (1.75rem) in one utility.
Numeric leading-4 to leading-10 Fixed spacing scale (multiples of 0.25rem).
Relative leading-none line-height: 1;
Custom leading-[32px] or leading-(--my-var) Arbitrary values or CSS variables.

Tracking (Letter Spacing)

Tracking is defined using em units so that it scales automatically with the font size. You can use the standard scale or map directly to your CSS variables.

Format Example Class Description
Standard
  • tracking-tighter
  • tracking-tight
  • tracking-normal
  • tracking-wide
  • tracking-wider
  • tracking-widest
Presets ranging from -0.05em to 0.1em.
Arbitrary tracking-[0.12em] Specific em or px values for precise kerning.
Variable tracking-(--brand-spacing) References a custom property defined in your CSS.

Example

Here is an example demonstrating how several of these typography utilities can be combined:

View Output

In the next page, we'll explore how Tailwind CSS handles backgrounds and gradients.