Font size
text-xs, text-sm, text-base, text-lg, text-xl, text-2xl … text-9xl
Font weight
font-light, font-normal, font-medium, font-semibold, font-bold, font-black
Font family
font-sans, font-serif, font-mono
Text helpers
| Class | Effect |
|---|---|
text-left / text-center / text-right |
alignment |
leading-tight / leading-relaxed |
line height |
tracking-wide / tracking-tight |
letter spacing |
uppercase, capitalize |
case |
italic, underline, line-through |
style |
decoration-sky-500, underline-offset-4 |
underline style |
truncate |
one line with … |
line-clamp-3 |
max 3 lines with … |
Size and line height together
text-lg/7 sets font size and line height in one class.
Example
Example — Typography utilities
HTML
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
<article class="max-w-xl p-6 space-y-3">
<p class="text-sm font-semibold uppercase tracking-widest text-indigo-600">Tutorial</p>
<h1 class="text-4xl font-black tracking-tight text-slate-900">Learn Tailwind Typography</h1>
<p class="text-lg/8 text-slate-600">Readable text needs a comfortable size, a relaxed line height and good contrast.</p>
<p>Links can have a <a href="#" class="underline decoration-sky-500 decoration-2 underline-offset-4 hover:decoration-4">styled underline</a>.</p>
<p class="font-mono text-sm bg-slate-100 px-2 py-1 rounded inline-block">font-mono for code</p>
<p class="line-clamp-2 text-slate-500 border p-2 rounded">This long description is limited to two lines with line-clamp-2. Any extra text after the second line is hidden and replaced with three dots, which is perfect for blog cards and product listings.</p>
</article>