Tailwind CSS v4.3 · CSS-first config · utilities · variants · masks · @theme · verified 2026

Tailwind CSS cheat sheet

Style with utility classes straight in your markup — flex items-center gap-4 p-6 rounded-lg instead of a separate stylesheet. Tailwind v4 is CSS-first: one @import "tailwindcss";, config in @theme (no tailwind.config.js), automatic content detection, and a design system exposed as native CSS variables. This edition covers the v4.1–4.3 additions — text-shadow & mask utilities, pointer/validation variants, scrollbar styling, and @source inline() safelisting — alongside the core vocabulary, responsive & state variants, container queries, and customization.

setup & theme core utilities variants & queries customization reference & migration gotcha most common

Verified 2026-09-08 against the Tailwind CSS docs & blog (tailwindcss.com). Latest is v4.3.3 (2026-07-16); this sheet targets v4.3 and flags which features landed in 4.1 / 4.2 / 4.3. v4 targets modern browsers (Safari 16.4+, Chrome 111+, Firefox 128+) and uses OKLCH colors, cascade layers & @property. ⚠️ v3 code differs a lot — the @tailwind directives & JS config are v3; see the migration card.

Outline

Import Tailwind, learn the utility grammar (layout → spacing → type/color/effects), stack responsive/state/pointer variants & container queries, then extend the system in CSS with @theme, @utility & @source.

Setup & core

  1. 1Install & import
  2. 2@theme config
  3. 3Layout: flex & grid
  4. 4Spacing & sizing
  5. 5Typography & color
  6. 6Effects & text-shadow

Variants & queries

  1. 7Responsive breakpoints
  2. 8State & dark variants
  3. 9Container queries
  4. 10More variants & pointers
  5. 11Masks & scrollbars

Customize & reference

  1. 12Arbitrary values & @apply
  2. 13Custom utilities & variants
  3. 14Directives, functions & @source
  4. 15What's new (4.1–4.3)
  5. 16v3 → v4 migration

Setup & Core

Install, configure in CSS, and lay out the page.

1Install & importv4 setup
2@theme configCSS-first
3Layout: flex & gridstructure
4Spacing & sizingthe scale

Core Utilities

Type, color, effects — and the prefixes that make utilities conditional.

5Typography & colorlook & feel
6Effects & text-shadowdepth & gradients
7Responsive breakpointsmobile-first
8State & dark variantsconditional styling

Variants & Queries

Container queries, pointer/validation variants, and the newest utilities.

9Container queriesbuilt-in in v4
10More variants & pointersv4.1 additions
11Masks & scrollbars4.1 & 4.3

Customization

Escape hatches, custom utilities, and the directive/function reference.

12Arbitrary values & @applyone-offs
13Custom utilities & variants@utility · @variant
14Directives, functions & @sourcethe @-rules

Reference & Migration

What's new across v4.1–4.3, and moving from v3.

15What's new (4.1–4.3)since v4.0
16v3 → v4 migrationwhat changed

Worth memorizing

@import "tailwindcss";one line replaces v3's 3 directives
@tailwindcss/viterecommended install; no content array
@theme { --color-* }CSS-first config → auto utilities
p-4 = 0.25rem × none --spacing token drives the scale
bg-blue-500/50color + /NN opacity (color-mix)
text-shadow-* · drop-shadow-<color>v4.1
mask-b-from-* · mask-radial-*gradient masks, v4.1
pointer-coarse: · user-valid:touch & validation variants (4.1)
scrollbar-thin · scrollbar-thumb-*scrollbar styling, v4.3
md: = that width AND UPmobile-first; base = unprefixed
@container + @md:container queries, built in
@source inline(...) · no dynamic class namessafelist for the scanner