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

ClassCSS
font-sanssystem UI / sans-serif stack
font-serifGeorgia / serif stack
font-monomonospace 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

ClassCSS
text-xsfont-size: 0.75rem; line-height: 1rem
text-smfont-size: 0.875rem; line-height: 1.25rem
text-basefont-size: 1rem; line-height: 1.5rem
text-lgfont-size: 1.125rem; line-height: 1.75rem
text-xlfont-size: 1.25rem; line-height: 1.75rem
text-2xlfont-size: 1.5rem; line-height: 2rem
text-3xlfont-size: 1.875rem; line-height: 2.25rem
text-4xlfont-size: 2.25rem; line-height: 2.5rem
text-5xlfont-size: 3rem; line-height: 1
text-6xlfont-size: 3.75rem; line-height: 1
text-7xlfont-size: 4.5rem; line-height: 1
text-8xlfont-size: 6rem; line-height: 1
text-9xlfont-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-height by default. Override it explicitly with leading-*.

Font Weight

ClassCSS
font-thinfont-weight: 100
font-extralightfont-weight: 200
font-lightfont-weight: 300
font-normalfont-weight: 400
font-mediumfont-weight: 500
font-semiboldfont-weight: 600
font-boldfont-weight: 700
font-extraboldfont-weight: 800
font-blackfont-weight: 900
font-[550]arbitrary weight

Font Style

ClassCSS
italicfont-style: italic
not-italicfont-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

ClassCSS
leading-noneline-height: 1
leading-tightline-height: 1.25
leading-snugline-height: 1.375
leading-normalline-height: 1.5
leading-relaxedline-height: 1.625
leading-looseline-height: 2
leading-3leading-10fixed 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

ClassCSS
tracking-tighterletter-spacing: -0.05em
tracking-tightletter-spacing: -0.025em
tracking-normalletter-spacing: 0em
tracking-wideletter-spacing: 0.025em
tracking-widerletter-spacing: 0.05em
tracking-widestletter-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

ClassCSS
text-lefttext-align: left
text-centertext-align: center
text-righttext-align: right
text-justifytext-align: justify
text-starttext-align: start (logical)
text-endtext-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

ClassCSS
underlinetext-decoration-line: underline
overlinetext-decoration-line: overline
line-throughtext-decoration-line: line-through
no-underlinetext-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

ClassCSS
decoration-solidtext-decoration-style: solid
decoration-doubletext-decoration-style: double
decoration-dottedtext-decoration-style: dotted
decoration-dashedtext-decoration-style: dashed
decoration-wavytext-decoration-style: wavy

Thickness

ClassCSS
decoration-autotext-decoration-thickness: auto
decoration-from-fontfrom font metrics
decoration-0text-decoration-thickness: 0px
decoration-11px
decoration-22px
decoration-44px
decoration-88px
decoration-[3px]arbitrary

Underline Offset

ClassCSS
underline-offset-autotext-underline-offset: auto
underline-offset-0text-underline-offset: 0px
underline-offset-11px
underline-offset-22px
underline-offset-44px
underline-offset-88px
underline-offset-[5px]arbitrary
<a class="underline underline-offset-4 decoration-2 decoration-blue-500 hover:decoration-blue-700">
  Styled link
</a>

Text Transform

ClassCSS
uppercasetext-transform: uppercase
lowercasetext-transform: lowercase
capitalizetext-transform: capitalize
normal-casetext-transform: none

Text Overflow

ClassCSS
truncateoverflow: hidden; text-overflow: ellipsis; white-space: nowrap
text-ellipsistext-overflow: ellipsis
text-cliptext-overflow: clip
<p class="truncate max-w-xs">Long text that will be cut off with an ellipsis...</p>

Whitespace

ClassCSS
whitespace-normalwhite-space: normal
whitespace-nowrapwhite-space: nowrap
whitespace-prewhite-space: pre
whitespace-pre-linewhite-space: pre-line
whitespace-pre-wrapwhite-space: pre-wrap
whitespace-break-spaceswhite-space: break-spaces

Text Indent

<p class="indent-8">First line indented by 2rem</p>
<p class="indent-[40px]">Arbitrary indent</p>
ClassValue
indent-px1px
indent-0indent-96spacing scale
indent-[value]arbitrary

Vertical Align

ClassCSS
align-baselinevertical-align: baseline
align-topvertical-align: top
align-middlevertical-align: middle
align-bottomvertical-align: bottom
align-text-topvertical-align: text-top
align-text-bottomvertical-align: text-bottom
align-subvertical-align: sub
align-supervertical-align: super
align-[4px]arbitrary

List Style

Type

ClassCSS
list-nonelist-style-type: none
list-disclist-style-type: disc
list-decimallist-style-type: decimal
list-[square]arbitrary

Position

ClassCSS
list-insidelist-style-position: inside
list-outsidelist-style-position: outside

Image

<ul class="list-[url(/bullet.png)]">...</ul>

Hyphens

ClassCSS
hyphens-nonehyphens: none
hyphens-manualhyphens: manual
hyphens-autohyphens: 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:

ClassEffect
prose-smSmall size
prose-baseDefault size
prose-lg / prose-xl / prose-2xlLarger sizes
prose-slateSlate color theme
prose-invertDark background version
prose-headings:font-boldTarget heading elements
prose-a:text-blue-600Target links

Install: npm install @tailwindcss/typography