Cheatsheets

Tailwind CSS Cheatsheet

Use this Tailwind CSS cheatsheet to recall layout, spacing, color, typography, button, card and responsive prefix utilities, with copyable class strings and generated HTML examples.

Quick reference

Layout

Flexflex items-center justify-between
Gridgrid grid-cols-3 gap-4
Container widthmx-auto max-w-6xl px-4
Hidden mobilehidden md:block

Spacing and sizing

Paddingp-4 px-6 py-3
Marginm-4 mt-8 mx-auto
Widthw-full max-w-md
Heighth-12 min-h-screen

Type and color

Headingtext-3xl font-bold tracking-tight
Muted texttext-slate-600
Backgroundbg-white dark:bg-slate-950
Rounded cardrounded-lg border shadow-sm

Visual patterns

Compare the syntax with a small rendered example so the reference is easier to scan and remember.

Layout utilities

Compose flex, alignment and gap utilities for common rows.

HTMLHTML
<div class="flex items-center justify-between gap-4">
  <span>Logo</span>
  <span>Docs</span>
  <strong>Start</strong>
</div>
Tailwind classesTailwind classes
flex items-center justify-between gap-4
Live preview
Mode
flexitems-centergap-4
Spacing scale

Tailwind spacing utilities map to a consistent scale.

HTMLHTML
<div class="p-4 rounded-lg border bg-white">
  Content
</div>
Tailwind classesTailwind classes
p-4
Live preview
p-4p-4p-4
Colour and typography

Combine text size, weight and color utilities for hierarchy.

HTMLHTML
<h2 class="text-2xl font-bold tracking-tight text-blue-600">Heading</h2>
<p class="text-slate-600">Supporting copy.</p>
Tailwind classesTailwind classes
text-2xl font-bold tracking-tight text-blue-600 text-slate-600
Live preview
text-sm text-slate-500text-2xl font-bold

Readable utility typography.

Button and card

Cards usually combine radius, border, background, padding and shadow.

HTMLHTML
<div class="rounded-lg border bg-white p-4 shadow-sm">
  <h3 class="font-bold">Utility card</h3>
  <p class="mt-2 text-slate-600">Rounded, bordered and spaced.</p>
  <button class="mt-4 rounded-full bg-blue-600 px-4 py-2 text-white">Button</button>
</div>
Tailwind classesTailwind classes
rounded-lg border bg-white p-4 shadow-sm mt-4 rounded-full bg-blue-600 px-4 py-2 text-white
Live preview
Utility card

p-4 rounded border shadow-sm.

Responsive prefixes

Use breakpoint prefixes to progressively enhance layout.

HTMLHTML
<div class="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
  <article>One</article>
  <article>Two</article>
  <article>Three</article>
</div>
Tailwind classesTailwind classes
grid gap-4 md:grid-cols-2 lg:grid-cols-3
Live preview
basemd:grid-cols-2lg:grid-cols-3

Learn the pattern

Short notes to help you decide when to use each pattern, avoid common mistakes and copy the examples with confidence.

When to use

  • Use Tailwind when utility classes help you move quickly inside components.
  • Use responsive prefixes for layout changes across breakpoints.
  • Use extracted components when class strings become repetitive.

Quick tips

  • Group classes mentally by layout, spacing, type, color and state.
  • Use the spacing scale consistently instead of arbitrary values.
  • Reach for responsive prefixes before writing custom media queries.

Common mistakes

  • Letting class strings grow without a clear order.
  • Mixing too many arbitrary values into a design system.
  • Using color utilities without checking contrast.

Best practices

  • Keep repeated patterns in components or presets.
  • Use semantic HTML with Tailwind classes on top.
  • Copy the smallest useful class group for the job.

Examples

CodeResponsive card
<div class="rounded-lg border bg-white p-6 shadow-sm md:p-8">
  <h2 class="text-2xl font-bold tracking-tight">Title</h2>
  <p class="mt-2 text-slate-600">Supporting copy.</p>
</div>

Tailwind FAQ

What is included in the Tailwind cheatsheet?

Tailwind CSS Cheatsheet includes quick reference sections, practical examples, common mistakes, tips and links to related DevKitYard tools.

Is the Tailwind cheatsheet interactive?

Yes. This cheatsheet includes visual examples with copyable code and lightweight controls where interaction helps explain the pattern.

When should I use this Tailwind reference?

Use it when you need to recall syntax, compare common patterns or avoid mistakes without opening a long tutorial.

What should I use after reading this cheatsheet?

Use related DevKitYard tools such as Tailwind Button Builder, React Component Generator when you need to format, validate, generate or inspect real output.