Tailwind Typography
Text styling is where utilities shine: size, weight, line height, letter spacing, alignment and decoration each have their own short class.
Font size
Font-size utilities set a size and a sensible default line height together.
| Class | Size | Class | Size |
|---|---|---|---|
text-xs |
0.75rem (12px) | text-2xl |
1.5rem (24px) |
text-sm |
0.875rem (14px) | text-3xl |
1.875rem (30px) |
text-base |
1rem (16px) | text-4xl |
2.25rem (36px) |
text-lg |
1.125rem (18px) | text-5xl |
3rem (48px) |
text-xl |
1.25rem (20px) | … text-9xl |
8rem (128px) |
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="space-y-1 p-4 text-slate-800">
<p class="text-xs">text-xs — fine print</p>
<p class="text-sm">text-sm — captions</p>
<p class="text-base">text-base — body copy</p>
<p class="text-xl">text-xl — subheading</p>
<p class="text-3xl font-bold">text-3xl — heading</p>
<p class="text-5xl font-black tracking-tight">Big 5xl</p>
</body>
</html>You can override the line height right on the size with a slash: text-lg/7 means "font size lg, line height 7 on the spacing scale (1.75rem)". text-sm/loose uses a named line height.
Font family, weight and style
| Class | Effect |
|---|---|
font-sans / font-serif / font-mono |
font stack |
font-thin (100) … font-normal (400) … font-bold (700) … font-black (900) |
weight |
italic / not-italic |
style |
uppercase / lowercase / capitalize / normal-case |
text transform |
Line height and letter spacing
| Class | CSS |
|---|---|
leading-none / leading-tight / leading-normal / leading-loose |
line-height: 1 / 1.25 / 1.5 / 2 |
leading-6 |
line-height: 1.5rem (spacing scale) |
tracking-tighter … tracking-wide … tracking-widest |
letter-spacing from -0.05em to 0.1em |
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="p-6">
<p class="text-xs font-semibold tracking-widest text-indigo-600 uppercase">Release notes</p>
<h1 class="mt-1 font-serif text-3xl font-bold text-gray-900 italic">A calmer way to write CSS</h1>
<p class="mt-3 max-w-md text-sm/6 text-gray-600">
This paragraph uses <code class="font-mono text-pink-600">text-sm/6</code>: small text with a roomy 1.5rem line height,
which makes long blocks easier to read.
</p>
</body>
</html>Alignment, decoration and overflow
| Class | Effect |
|---|---|
text-left / text-center / text-right / text-justify |
alignment |
underline / line-through / no-underline |
decoration line |
decoration-wavy / decoration-dotted / decoration-2 |
decoration style and thickness |
underline-offset-4 |
gap between text and underline |
truncate |
one line, cut off with … |
line-clamp-2 |
at most 2 lines, then … |
text-balance / text-pretty |
nicer line breaks for headings / paragraphs |
whitespace-nowrap / break-words |
wrapping control |
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="space-y-4 p-4">
<p class="w-56 truncate rounded bg-gray-100 p-2">truncate: this sentence is far too long to fit in the box</p>
<p class="line-clamp-2 w-56 rounded bg-gray-100 p-2">line-clamp-2: here is a longer paragraph that keeps going and going, but only the first two lines are ever shown to the reader.</p>
<p class="text-center underline decoration-sky-500 decoration-wavy decoration-2 underline-offset-4">Centred, wavy, offset underline</p>
<p class="text-gray-400 line-through">Old price $49</p>
</body>
</html>Note: In v4,
overflow-ellipsiswas renamed totext-ellipsis.truncatestill combinesoverflow-hidden,text-ellipsisandwhitespace-nowrap.
Styling long-form content
Preflight removes default heading and list styles, so a blog post written in plain HTML looks flat. Either style each element (as above) or use the official Typography plugin, whose prose class styles a whole article at once — see the Plugins lesson.
Tip: Use
text-balanceon headings so lines break evenly, andtext-prettyon paragraphs to avoid a single orphaned word on the last line.
Test yourself
What does text-lg/7 set?
- Font size lg and 7% opacity
- Font size lg and line height 1.75rem
- Font weight 700
- Letter spacing 7px
Which class limits text to three lines with an ellipsis?
truncate-3line-clamp-3max-lines-3text-ellipsis-3
Which class makes text all capitals without changing the HTML?
capitalizeuppercasefont-capstext-upper