Tailwind CSS Cheatsheet
Typography
Use this Tailwind CSS reference while you build software engineering projects, review code for technical interview prep, or polish examples for a software engineer resume.
Font Family
| Class | CSS |
|---|---|
font-sans | system UI / sans-serif stack |
font-serif | Georgia / serif stack |
font-mono | monospace stack |
font-[Inter] | arbitrary font family |
Configure custom families in your CSS (v4) or tailwind.config.js (v3):
/* v4 — in your CSS */ @theme { --font-display: 'Cal Sans', sans-serif; }
<!-- Usage --> <h1 class="font-display">Heading</h1>
Font Size
| Class | CSS |
|---|---|
text-xs | font-size: 0.75rem; line-height: 1rem |
text-sm | font-size: 0.875rem; line-height: 1.25rem |
text-base | font-size: 1rem; line-height: 1.5rem |
text-lg | font-size: 1.125rem; line-height: 1.75rem |
text-xl | font-size: 1.25rem; line-height: 1.75rem |
text-2xl | font-size: 1.5rem; line-height: 2rem |
text-3xl | font-size: 1.875rem; line-height: 2.25rem |
text-4xl | font-size: 2.25rem; line-height: 2.5rem |
text-5xl | font-size: 3rem; line-height: 1 |
text-6xl | font-size: 3.75rem; line-height: 1 |
text-7xl | font-size: 4.5rem; line-height: 1 |
text-8xl | font-size: 6rem; line-height: 1 |
text-9xl | font-size: 8rem; line-height: 1 |
text-[1.625rem] | arbitrary font size |
text-[clamp(1rem,2.5vw,1.5rem)] | fluid / clamp |
Font-size utilities also set a paired
line-heightby default. Override it explicitly withleading-*.
Font Weight
| Class | CSS |
|---|---|
font-thin | font-weight: 100 |
font-extralight | font-weight: 200 |
font-light | font-weight: 300 |
font-normal | font-weight: 400 |
font-medium | font-weight: 500 |
font-semibold | font-weight: 600 |
font-bold | font-weight: 700 |
font-extrabold | font-weight: 800 |
font-black | font-weight: 900 |
font-[550] | arbitrary weight |
Font Style
| Class | CSS |
|---|---|
italic | font-style: italic |
not-italic | font-style: normal |
Font Variant Numeric
<p class="font-variant-numeric: tabular-nums"> <!-- Tailwind classes: --> <p class="tabular-nums">1,234,567</p> <p class="oldstyle-nums">1234</p> <p class="lining-nums">1234</p> <p class="proportional-nums">1234</p> <p class="slashed-zero">0</p> <p class="diagonal-fractions">1/2</p> <p class="stacked-fractions">1/2</p> <p class="ordinal">1st 2nd 3rd</p>
Line Height
| Class | CSS |
|---|---|
leading-none | line-height: 1 |
leading-tight | line-height: 1.25 |
leading-snug | line-height: 1.375 |
leading-normal | line-height: 1.5 |
leading-relaxed | line-height: 1.625 |
leading-loose | line-height: 2 |
leading-3 – leading-10 | fixed rem values (0.75rem–2.5rem) |
leading-[1.8] | arbitrary |
<h1 class="text-4xl font-bold leading-tight"> Tight heading for large display text </h1> <p class="text-base leading-relaxed"> Body copy reads better with relaxed line height. </p>
Letter Spacing
| Class | CSS |
|---|---|
tracking-tighter | letter-spacing: -0.05em |
tracking-tight | letter-spacing: -0.025em |
tracking-normal | letter-spacing: 0em |
tracking-wide | letter-spacing: 0.025em |
tracking-wider | letter-spacing: 0.05em |
tracking-widest | letter-spacing: 0.1em |
tracking-[.2em] | arbitrary |
<!-- Micro-label pattern: small, uppercase, spaced --> <span class="text-xs font-semibold uppercase tracking-widest text-gray-500"> Category </span>
Text Alignment
| Class | CSS |
|---|---|
text-left | text-align: left |
text-center | text-align: center |
text-right | text-align: right |
text-justify | text-align: justify |
text-start | text-align: start (logical) |
text-end | text-align: end (logical) |
Text Color
Uses the full color palette — text-{color}-{shade}:
<p class="text-slate-900">Dark text</p> <p class="text-slate-500">Muted text</p> <p class="text-blue-600">Accent text</p> <p class="text-[#ff6b35]">Arbitrary hex</p> <p class="text-white/75">White at 75% opacity</p>
See the Colors and Backgrounds page for the full palette.
Text Decoration
Type
| Class | CSS |
|---|---|
underline | text-decoration-line: underline |
overline | text-decoration-line: overline |
line-through | text-decoration-line: line-through |
no-underline | text-decoration-line: none |
Color
<a class="underline decoration-blue-500">Link</a> <a class="underline decoration-current">Link</a> <a class="underline decoration-[#ff6b35]">Link</a>
Style
| Class | CSS |
|---|---|
decoration-solid | text-decoration-style: solid |
decoration-double | text-decoration-style: double |
decoration-dotted | text-decoration-style: dotted |
decoration-dashed | text-decoration-style: dashed |
decoration-wavy | text-decoration-style: wavy |
Thickness
| Class | CSS |
|---|---|
decoration-auto | text-decoration-thickness: auto |
decoration-from-font | from font metrics |
decoration-0 | text-decoration-thickness: 0px |
decoration-1 | 1px |
decoration-2 | 2px |
decoration-4 | 4px |
decoration-8 | 8px |
decoration-[3px] | arbitrary |
Underline Offset
| Class | CSS |
|---|---|
underline-offset-auto | text-underline-offset: auto |
underline-offset-0 | text-underline-offset: 0px |
underline-offset-1 | 1px |
underline-offset-2 | 2px |
underline-offset-4 | 4px |
underline-offset-8 | 8px |
underline-offset-[5px] | arbitrary |
<a class="underline underline-offset-4 decoration-2 decoration-blue-500 hover:decoration-blue-700"> Styled link </a>
Text Transform
| Class | CSS |
|---|---|
uppercase | text-transform: uppercase |
lowercase | text-transform: lowercase |
capitalize | text-transform: capitalize |
normal-case | text-transform: none |
Text Overflow
| Class | CSS |
|---|---|
truncate | overflow: hidden; text-overflow: ellipsis; white-space: nowrap |
text-ellipsis | text-overflow: ellipsis |
text-clip | text-overflow: clip |
<p class="truncate max-w-xs">Long text that will be cut off with an ellipsis...</p>
Whitespace
| Class | CSS |
|---|---|
whitespace-normal | white-space: normal |
whitespace-nowrap | white-space: nowrap |
whitespace-pre | white-space: pre |
whitespace-pre-line | white-space: pre-line |
whitespace-pre-wrap | white-space: pre-wrap |
whitespace-break-spaces | white-space: break-spaces |
Text Indent
<p class="indent-8">First line indented by 2rem</p> <p class="indent-[40px]">Arbitrary indent</p>
| Class | Value |
|---|---|
indent-px | 1px |
indent-0 – indent-96 | spacing scale |
indent-[value] | arbitrary |
Vertical Align
| Class | CSS |
|---|---|
align-baseline | vertical-align: baseline |
align-top | vertical-align: top |
align-middle | vertical-align: middle |
align-bottom | vertical-align: bottom |
align-text-top | vertical-align: text-top |
align-text-bottom | vertical-align: text-bottom |
align-sub | vertical-align: sub |
align-super | vertical-align: super |
align-[4px] | arbitrary |
List Style
Type
| Class | CSS |
|---|---|
list-none | list-style-type: none |
list-disc | list-style-type: disc |
list-decimal | list-style-type: decimal |
list-[square] | arbitrary |
Position
| Class | CSS |
|---|---|
list-inside | list-style-position: inside |
list-outside | list-style-position: outside |
Image
<ul class="list-[url(/bullet.png)]">...</ul>
Hyphens
| Class | CSS |
|---|---|
hyphens-none | hyphens: none |
hyphens-manual | hyphens: manual |
hyphens-auto | hyphens: auto |
Content (before/after pseudo-elements)
<span class="before:content-['*'] before:text-red-500 before:mr-1">Required</span> <blockquote class="before:content-['\201C'] after:content-['\201D']">Quote</blockquote> <a class="after:content-['_↗']" href="https://example.com">External</a>
Prose (Typography Plugin)
The @tailwindcss/typography plugin adds the prose class for rich text rendering:
<article class="prose lg:prose-xl max-w-none"> <h1>Heading</h1> <p>Content...</p> </article>
Key modifiers:
| Class | Effect |
|---|---|
prose-sm | Small size |
prose-base | Default size |
prose-lg / prose-xl / prose-2xl | Larger sizes |
prose-slate | Slate color theme |
prose-invert | Dark background version |
prose-headings:font-bold | Target heading elements |
prose-a:text-blue-600 | Target links |
Install: npm install @tailwindcss/typography