Tailwind CSS v4 Cheat Sheet (Searchable) | How-to Guide

A searchable Tailwind CSS v4 cheat sheet: type any class or plain word and see the exact CSS v4 generates, from var(--spacing) multiples to OKLCH color tokens. It also covers @theme tokens, breakpoints, container queries, live flex and grid boxes, the full color palette, dark mode, and v3 to v4 renames.

This sheet covers Tailwind CSS v4 (v4.3 is the current release at the time of writing, October 2026). For each class it shows the CSS that v4 actually writes, which matters because v4 changed how values are produced: spacing is a multiple of one --spacing variable, colors are --color-* variables defined in OKLCH, and sizes such as radius, shadow and text come from named theme variables. Type in the box to filter. Search works on class names, the CSS they output, and plain words such as "center", "gradient" or "sticky".

Showing all 243

ClassCSS it outputs in v4
Layout and display
blockdisplay: block;
inline-blockdisplay: inline-block;
inlinedisplay: inline;
flexdisplay: flex;
inline-flexdisplay: inline-flex;
griddisplay: grid;
inline-griddisplay: inline-grid;
contentsdisplay: contents;
hiddendisplay: none;
containerwidth: 100%; plus max-width: var(--breakpoint-sm) at sm, and so on for each breakpoint
box-borderbox-sizing: border-box;
box-contentbox-sizing: content-box;
staticposition: static;
relativeposition: relative;
absoluteposition: absolute;
fixedposition: fixed;
stickyposition: sticky;
inset-0inset: calc(var(--spacing) * 0);
inset-x-0inset-inline: calc(var(--spacing) * 0);
top-4top: calc(var(--spacing) * 4); /* 1rem */
-top-2top: calc(var(--spacing) * -2);
left-1/2left: calc(1/2 * 100%);
z-10z-index: 10;
z-50z-index: 50;
isolateisolation: isolate;
overflow-hiddenoverflow: hidden;
overflow-autooverflow: auto;
overflow-x-autooverflow-x: auto;
aspect-videoaspect-ratio: var(--aspect-video); /* 16 / 9 */
aspect-squareaspect-ratio: 1 / 1;
object-coverobject-fit: cover;
object-containobject-fit: contain;
visiblevisibility: visible;
invisiblevisibility: hidden;
sr-onlyposition: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border-width: 0;
Flexbox
flex-rowflex-direction: row;
flex-colflex-direction: column;
flex-row-reverseflex-direction: row-reverse;
flex-wrapflex-wrap: wrap;
flex-nowrapflex-wrap: nowrap;
flex-1flex: 1;
flex-autoflex: auto;
flex-initialflex: 0 auto;
flex-noneflex: none;
growflex-grow: 1;
grow-0flex-grow: 0;
shrink-0flex-shrink: 0;
basis-64flex-basis: calc(var(--spacing) * 64);
basis-1/3flex-basis: calc(1/3 * 100%);
order-2order: 2;
order-firstorder: -9999;
order-lastorder: 9999;
Alignment and gap
justify-startjustify-content: flex-start;
justify-centerjustify-content: center;
justify-endjustify-content: flex-end;
justify-betweenjustify-content: space-between;
justify-aroundjustify-content: space-around;
justify-evenlyjustify-content: space-evenly;
items-startalign-items: flex-start;
items-centeralign-items: center;
items-endalign-items: flex-end;
items-baselinealign-items: baseline;
items-stretchalign-items: stretch;
self-centeralign-self: center;
self-endalign-self: flex-end;
content-centeralign-content: center;
place-items-centerplace-items: center;
place-content-centerplace-content: center;
justify-items-centerjustify-items: center;
gap-4gap: calc(var(--spacing) * 4); /* 1rem */
gap-x-6column-gap: calc(var(--spacing) * 6);
gap-y-2row-gap: calc(var(--spacing) * 2);
Grid
grid-cols-3grid-template-columns: repeat(3, minmax(0, 1fr));
grid-cols-12grid-template-columns: repeat(12, minmax(0, 1fr));
grid-cols-[200px_1fr]grid-template-columns: 200px 1fr;
grid-cols-subgridgrid-template-columns: subgrid;
grid-rows-3grid-template-rows: repeat(3, minmax(0, 1fr));
col-span-2grid-column: span 2 / span 2;
col-span-fullgrid-column: 1 / -1;
col-start-2grid-column-start: 2;
row-span-2grid-row: span 2 / span 2;
grid-flow-colgrid-auto-flow: column;
grid-flow-densegrid-auto-flow: dense;
auto-rows-frgrid-auto-rows: minmax(0, 1fr);
auto-cols-maxgrid-auto-columns: max-content;
Spacing
p-4padding: calc(var(--spacing) * 4); /* 1rem */
p-pxpadding: 1px;
p-[13px]padding: 13px;
p-(--card-pad)padding: var(--card-pad);
px-6padding-inline: calc(var(--spacing) * 6);
py-2padding-block: calc(var(--spacing) * 2);
pt-8padding-top: calc(var(--spacing) * 8);
ps-4padding-inline-start: calc(var(--spacing) * 4);
m-0margin: calc(var(--spacing) * 0);
mx-automargin-inline: auto;
mt-6margin-top: calc(var(--spacing) * 6);
-mt-2margin-top: calc(var(--spacing) * -2);
ms-automargin-inline-start: auto;
space-y-4margin-block-end: calc(var(--spacing) * 4) on every child except the last (selector: > :not(:last-child))
space-x-2margin-inline-end: calc(var(--spacing) * 2) on every child except the last
Sizing
w-64width: calc(var(--spacing) * 64); /* 16rem */
w-fullwidth: 100%;
w-1/2width: calc(1/2 * 100%);
w-screenwidth: 100vw;
w-fitwidth: fit-content;
w-autowidth: auto;
size-10width: calc(var(--spacing) * 10); height: calc(var(--spacing) * 10);
h-12height: calc(var(--spacing) * 12);
h-dvhheight: 100dvh;
h-screenheight: 100vh;
min-h-screenmin-height: 100vh;
min-w-0min-width: calc(var(--spacing) * 0);
max-w-mdmax-width: var(--container-md); /* 28rem */
max-w-7xlmax-width: var(--container-7xl); /* 80rem */
max-w-prosemax-width: 65ch;
max-w-screen-lgmax-width: var(--breakpoint-lg);
Typography
text-xsfont-size: var(--text-xs); /* 0.75rem */ line-height: var(--tw-leading, var(--text-xs--line-height));
text-smfont-size: var(--text-sm); /* 0.875rem */ line-height: var(--tw-leading, var(--text-sm--line-height));
text-basefont-size: var(--text-base); /* 1rem */ line-height: var(--tw-leading, var(--text-base--line-height));
text-xlfont-size: var(--text-xl); /* 1.25rem */ line-height: var(--tw-leading, var(--text-xl--line-height));
text-4xlfont-size: var(--text-4xl); /* 2.25rem */ line-height: var(--tw-leading, var(--text-4xl--line-height));
text-sm/6font-size: var(--text-sm); line-height: calc(var(--spacing) * 6);
font-sansfont-family: var(--font-sans);
font-monofont-family: var(--font-mono);
font-mediumfont-weight: var(--font-weight-medium); /* 500 */
font-semiboldfont-weight: var(--font-weight-semibold); /* 600 */
font-boldfont-weight: var(--font-weight-bold); /* 700 */
leading-tightline-height: var(--leading-tight); /* 1.25 */
leading-6line-height: calc(var(--spacing) * 6);
tracking-tightletter-spacing: var(--tracking-tight); /* -0.025em */
tracking-wideletter-spacing: var(--tracking-wide);
text-lefttext-align: left;
text-centertext-align: center;
text-righttext-align: right;
uppercasetext-transform: uppercase;
capitalizetext-transform: capitalize;
italicfont-style: italic;
underlinetext-decoration-line: underline;
no-underlinetext-decoration-line: none;
underline-offset-4text-underline-offset: 4px;
decoration-2text-decoration-thickness: 2px;
truncateoverflow: hidden; text-overflow: ellipsis; white-space: nowrap;
line-clamp-3overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
text-balancetext-wrap: balance;
text-prettytext-wrap: pretty;
whitespace-nowrapwhite-space: nowrap;
wrap-break-wordoverflow-wrap: break-word; /* added in v4.1 */
tabular-numsfont-variant-numeric: tabular-nums;
antialiased-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
Color and backgrounds
text-blue-600color: var(--color-blue-600); /* oklch(54.6% 0.245 262.881) */
bg-whitebackground-color: var(--color-white); /* #fff */
bg-slate-900background-color: var(--color-slate-900);
bg-black/50background-color: color-mix(in oklab, var(--color-black) 50%, transparent);
bg-[#4f98fb]background-color: #4f98fb;
bg-(--brand)background-color: var(--brand);
text-currentcolor: currentColor;
bg-transparentbackground-color: transparent;
border-gray-200border-color: var(--color-gray-200);
fill-currentfill: currentColor;
accent-blue-600accent-color: var(--color-blue-600);
caret-pink-500caret-color: var(--color-pink-500);
bg-linear-to-rbackground-image: linear-gradient(to right in oklab, var(--tw-gradient-stops)); /* simplified */
from-blue-500--tw-gradient-from: var(--color-blue-500); /* first stop */
to-violet-500--tw-gradient-to: var(--color-violet-500);
bg-radialbackground-image: radial-gradient(...stops); /* new in v4 */
bg-coverbackground-size: cover;
bg-centerbackground-position: center;
bg-no-repeatbackground-repeat: no-repeat;
bg-clip-textbackground-clip: text;
Borders, radius, rings and outlines
borderborder-style: var(--tw-border-style); border-width: 1px; /* color is currentColor in v4 */
border-2border-style: var(--tw-border-style); border-width: 2px;
border-tborder-top-style: var(--tw-border-style); border-top-width: 1px;
border-dashed--tw-border-style: dashed; border-style: dashed;
rounded-xsborder-radius: var(--radius-xs); /* 0.125rem */
rounded-smborder-radius: var(--radius-sm); /* 0.25rem */
rounded-mdborder-radius: var(--radius-md); /* 0.375rem */
rounded-lgborder-radius: var(--radius-lg); /* 0.5rem */
rounded-2xlborder-radius: var(--radius-2xl); /* 1rem */
rounded-fullborder-radius: calc(infinity * 1px);
rounded-t-lgborder-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg);
divide-yborder-bottom-width: 1px on every child except the last (selector: > :not(:last-child))
ring-1box-shadow: 0 0 0 1px currentColor; /* simplified; v4 default ring width is 1px */
ring-3box-shadow: 0 0 0 3px currentColor; /* the old v3 ring */
ring-blue-500--tw-ring-color: var(--color-blue-500);
ring-offset-2--tw-ring-offset-width: 2px;
outlineoutline-style: var(--tw-outline-style); outline-width: 1px;
outline-2outline-style: var(--tw-outline-style); outline-width: 2px;
outline-offset-2outline-offset: 2px;
outline-hiddenoutline: 2px solid transparent; outline-offset: 2px; /* still visible in forced colors */
outline-none--tw-outline-style: none; outline-style: none;
Effects and filters
shadow-2xsbox-shadow: 0 1px rgb(0 0 0 / 0.05);
shadow-xsbox-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
shadow-smbox-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
shadow-mdbox-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
shadow-lgbox-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
shadow-2xlbox-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
shadow-nonebox-shadow: 0 0 #0000;
inset-shadow-smbox-shadow: inset 0 2px 4px rgb(0 0 0 / 0.05); /* new in v4 */
opacity-50opacity: 50%;
mix-blend-multiplymix-blend-mode: multiply;
blur-smfilter: blur(var(--blur-sm)); /* 8px */
blur-xsfilter: blur(var(--blur-xs)); /* 4px */
backdrop-blur-mdbackdrop-filter: blur(var(--blur-md)); /* 12px, frosted glass */
grayscalefilter: grayscale(100%);
Transitions, animation and transforms
transitiontransition-property: color, background-color, border-color, outline-color, opacity, box-shadow, transform, translate, scale, rotate, filter and more; transition-duration: 150ms;
transition-colorstransition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke and gradient stops; 150ms
duration-200transition-duration: 200ms;
ease-outtransition-timing-function: var(--ease-out); /* cubic-bezier(0, 0, 0.2, 1) */
animate-spinanimation: var(--animate-spin); /* spin 1s linear infinite */
animate-pulseanimation: var(--animate-pulse);
motion-reduce:animate-none@media (prefers-reduced-motion: reduce) { animation: none; }
scale-95--tw-scale-x: 95%; --tw-scale-y: 95%; scale: var(--tw-scale-x) var(--tw-scale-y);
rotate-45rotate: 45deg;
translate-x-4--tw-translate-x: calc(var(--spacing) * 4); translate: var(--tw-translate-x) var(--tw-translate-y);
-translate-y-1/2--tw-translate-y: calc(calc(1/2 * 100%) * -1); translate: var(--tw-translate-x) var(--tw-translate-y);
Interactivity
cursor-pointercursor: pointer; /* v4 buttons default to cursor: default */
cursor-not-allowedcursor: not-allowed;
pointer-events-nonepointer-events: none;
select-noneuser-select: none;
appearance-noneappearance: none;
scroll-smoothscroll-behavior: smooth;
snap-xscroll-snap-type: x var(--tw-scroll-snap-strictness);
snap-startscroll-snap-align: start;
scroll-mt-20scroll-margin-top: calc(var(--spacing) * 20);
resize-yresize: vertical;
touch-manipulationtouch-action: manipulation;
State and media variants
hover:bg-blue-700@media (hover: hover) { &:hover { background-color: var(--color-blue-700); } }
focus-visible:outline-2&:focus-visible { outline-width: 2px; ... }
active:scale-95&:active { scale: 95%; }
disabled:opacity-50&:disabled { opacity: 50%; }
aria-disabled:opacity-50&[aria-disabled="true"] { opacity: 50%; }
group-hover:underline.group:hover & { text-decoration-line: underline; } (inside @media (hover: hover))
peer-checked:bg-blue-600.peer:checked ~ & { background-color: var(--color-blue-600); }
md:flex@media (width >= 48rem) { display: flex; }
max-md:hidden@media (width < 48rem) { display: none; }
@md:flex-row@container (width >= 28rem) { flex-direction: row; }
dark:bg-slate-900@media (prefers-color-scheme: dark) { background-color: var(--color-slate-900); }
print:hidden@media print { display: none; }
motion-safe:animate-spin@media (prefers-reduced-motion: no-preference) { ... }
*:p-2:where(& > *) { padding: calc(var(--spacing) * 2); }
not-last:mb-2&:not(:last-child) { margin-bottom: ... }
supports-[display:grid]:grid@supports (display: grid) { display: grid; }
bg-red-500!background-color: var(--color-red-500) !important;

Notes on reading the table: calc(var(--spacing) * 4) is 1rem because the default --spacing is 0.25rem. Change that one variable in @theme and every padding, margin, gap, width and height that uses the number scale changes with it. Where the generated CSS is long (gradients, rings, transitions), the table shows a simplified version and says so.

How v4 turns a class into a value

There are four ways to give a utility a value in v4, and knowing which one you are using explains most surprises:

Fractions such as w-1/2 become calc(1/2 * 100%), and an opacity suffix such as bg-black/50 becomes a color-mix() with transparent, so it works with any color format.

@theme tokens (the v4 replacement for tailwind.config.js)

In v4 you configure the design system in CSS. Variables declared inside @theme become both CSS custom properties on :root and the source for utility classes. The prefix of the variable decides which utilities it feeds:

@import "tailwindcss";

@theme {
  --font-display: "Satoshi", sans-serif;   /* font-display */
  --color-brand-500: oklch(65% 0.17 255);  /* bg-brand-500, text-brand-500 ... */
  --breakpoint-3xl: 120rem;                /* 3xl: variant */
  --spacing: 0.25rem;                      /* p-4 = 1rem */
  --radius-card: 0.875rem;                 /* rounded-card */
}
NamespaceFeedsExample
--color-*every color utility (bg, text, border, fill, ring, shadow color...)bg-red-500
--spacingpadding, margin, gap, width, height, inset, translatepx-4
--font-*font familyfont-sans
--text-*font size (plus optional --text-*--line-height)text-xl
--font-weight-*font weightfont-bold
--tracking-* / --leading-*letter spacing / line heighttracking-wide
--breakpoint-*responsive variantssm:*
--container-*container query variants and max-w-*@sm:*, max-w-md
--radius-*border radiusrounded-sm
--shadow-*, --inset-shadow-*, --drop-shadow-*shadowsshadow-md
--blur-*blur and backdrop blurblur-md
--ease-* / --animate-*timing functions / animationsease-out, animate-spin
--perspective-* / --aspect-*3D perspective / aspect ratioperspective-near, aspect-video

To drop a whole default namespace, set it to initial first, for example --color-*: initial;, then declare only your own colors. If you still have a JavaScript config, v4 can load it with @config "./tailwind.config.js";, but the corePlugins, safelist and separator options are not supported.

Breakpoints

Breakpoints are mobile first: an unprefixed class applies at every width, and md:flex applies from 48rem up. v4 writes them with the range syntax width >= ....

PrefixMin widthCSSBelow it (max-*)
sm:40rem (640px)@media (width >= 40rem)max-sm: = @media (width < 40rem)
md:48rem (768px)@media (width >= 48rem)max-md:
lg:64rem (1024px)@media (width >= 64rem)max-lg:
xl:80rem (1280px)@media (width >= 80rem)max-xl:
2xl:96rem (1536px)@media (width >= 96rem)max-2xl:

Stack them to target a range: md:max-xl:flex applies only from 48rem up to (not including) 80rem. For a one-off breakpoint use min-[900px]:grid or max-[600px]:hidden. Add or change breakpoints with --breakpoint-* in @theme, and keep them all in rem so they sort correctly.

Container queries

Container queries are built into v4 (in v3 they needed a plugin). Mark a parent with @container, then style children with @sm:, @md: and so on. They react to the parent's width rather than the window, which is what you want for a card that appears both in a sidebar and in a wide main column.

<div>
  <article>
    <img src="..." alt="">
    <div>...</div>
  </article>
</div>
VariantContainer widthVariantContainer width
@3xs16rem (256px)@2xl42rem (672px)
@2xs18rem (288px)@3xl48rem (768px)
@xs20rem (320px)@4xl56rem (896px)
@sm24rem (384px)@5xl64rem (1024px)
@md28rem (448px)@6xl72rem (1152px)
@lg32rem (512px)@7xl80rem (1280px)
@xl36rem (576px)

Each one compiles to @container (width >= ...). Use @max-md: for "below", stack @sm:@max-md: for a range, name containers with @container/sidebar and target them with @md/sidebar:, and use arbitrary sizes such as @min-[475px]:. Note the container sizes are not the same numbers as the breakpoints: @md is 28rem while md: is 48rem.

Flex and grid quick reference

Pick a layout below and watch the boxes move. The class string updates as you click, so you can copy it straight into your markup.

The patterns you will reach for most often:

flex items-center justify-between: navbar row
flex items-center justify-center (or grid place-items-center): center one thing
grid grid-cols-3 gap-2 with col-span-2
shrink-0 on the fixed item, flex-1 on the item that fills
GoalClasses
Responsive card grid without breakpointsgrid grid-cols-[repeat(auto-fill,minmax(16rem,1fr))] gap-6
Sidebar plus contentgrid md:grid-cols-[16rem_1fr] gap-8
Footer pinned to the bottom of a short pageflex min-h-dvh flex-col on the wrapper, flex-1 on main
Text that truncates inside a flex rowmin-w-0 on the flex child, truncate on the text
Stack on mobile, row on desktopflex flex-col md:flex-row gap-4
Push the last item to the rightms-auto (or ml-auto) on that item

Default color palette (OKLCH), click to copy

v4 defines the default palette in OKLCH, which can show more saturated colors on wide-gamut screens. Each swatch below is painted with the exact value from Tailwind's own theme file; click one to copy its oklch() value. The shades run 50 to 950. Palettes marked * (mauve, olive, mist and taupe) were added in v4.2.0, so they are missing in earlier v4 releases. Black and white are #000 and #fff.

Showing all 26
50100200300400500600700800900950
red
orange
amber
yellow
lime
green
emerald
teal
cyan
sky
blue
indigo
violet
purple
fuchsia
pink
rose
slate
gray
zinc
neutral
stone
mauve*
olive*
mist*
taupe*

Use them as bg-sky-500, text-sky-500/80 or, in your own CSS, var(--color-sky-500). To check whether a pairing is readable, run it through the color contrast checker, and for a custom scale in the same format try the Tailwind color palette generator.

Dark mode in v4

By default dark: follows the operating system through @media (prefers-color-scheme: dark). To drive it from a class or attribute instead (for a manual toggle), override the variant in your CSS with @custom-variant. There is no darkMode config key any more.

/* Class strategy: <html> */
@custom-variant dark (&:where(.dark, .dark *));

/* Or a data attribute: <html data-theme="dark"> */
@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
<div>...</div>

With a manual toggle, set the class before the page paints (a small inline script in <head> that reads the saved choice) so visitors do not see a flash of the wrong theme. A third option is to skip dark: classes entirely: define semantic tokens such as --color-surface in @theme and swap their values under .dark, so one class like bg-surface works in both themes.

v3 to v4: renamed and changed classes

These come from the official upgrade guide. The renames matter most because the old names still exist and quietly produce a different (smaller) result.

v3v4Why
shadow-smshadow-xsScale shifted down one step so every size has a name
shadowshadow-smSame shift
drop-shadow-sm / drop-shadowdrop-shadow-xs / drop-shadow-smSame shift
blur-sm / blurblur-xs / blur-smSame shift (also backdrop-blur-*)
rounded-smrounded-xsSame shift
roundedrounded-smSame shift
outline-noneoutline-hiddenv4 outline-none now really sets outline-style: none
ring (3px, blue-500)ring-3 plus a colorBare ring is now 1px in currentColor
outline outline-2outline-2Width utilities now set a solid style themselves
bg-opacity-50 (and text-, border-, ring-, divide-, placeholder-opacity)bg-black/50Removed; use the slash modifier
flex-shrink-0 / flex-growshrink-0 / growRemoved aliases
overflow-ellipsistext-ellipsisRemoved alias
decoration-slice / decoration-clonebox-decoration-slice / box-decoration-cloneRemoved aliases
bg-[--brand]bg-(--brand)New shorthand for CSS variables
!bg-red-500bg-red-500!Important goes at the end (old form deprecated)
first:*:pt-0*:first:pt-0Stacked variants now read left to right
tw-flex (prefix)tw:flexPrefixes look like a variant and come first

Behavior changes with no rename, which catch people during upgrades:

The official npx @tailwindcss/upgrade tool handles most renames automatically. Run it on a clean branch and review the diff, since it cannot know which shadow classes you meant to keep looking the same.

Printing this sheet

This page has print styles: the search boxes and buttons are hidden, the tables shrink to a smaller font, and the color grid keeps its swatches together. In most browsers, turn on "Background graphics" in the print dialog or the swatches print blank. If you filtered the table first, only the visible rows print, which is a quick way to make a one-page sheet of just the utilities you use.

The same print: variant works in your own projects: print:hidden on navigation, print:text-black on light text, and print:break-inside-avoid on cards keep printed pages readable.

Frequently asked questions

Where is tailwind.config.js in Tailwind v4?

v4 is configured in CSS. You import Tailwind with @import "tailwindcss" and declare design tokens inside an @theme block, such as --color-brand-500 or --breakpoint-3xl. A JavaScript config can still be loaded with the @config directive, but the corePlugins, safelist and separator options are not supported.

What are the default Tailwind v4 breakpoints?

sm is 40rem (640px), md is 48rem (768px), lg is 64rem (1024px), xl is 80rem (1280px) and 2xl is 96rem (1536px). They are mobile first, so md:flex applies from 48rem and wider. Use max-md: for styles below a breakpoint and stack them, such as md:max-xl:, for a range.

Why do my shadows and rounded corners look smaller after upgrading to v4?

The shadow, radius and blur scales moved down one step. v3 shadow-sm is v4 shadow-xs, v3 shadow is v4 shadow-sm, v3 rounded-sm is v4 rounded-xs and v3 rounded is v4 rounded-sm. The old names still compile, so nothing errors; they just produce the next size down.

How do I make dark mode use a class instead of the system setting in v4?

Add @custom-variant dark (&:where(.dark, .dark *)); to your CSS. dark: utilities then apply whenever an ancestor has the dark class. Use [data-theme=dark] in the selector instead if you prefer a data attribute.

Does Tailwind v4 need a plugin for container queries?

No. Container queries are built in. Put @container on the parent and use variants such as @sm:, @md: and @max-md: on its children. The container sizes start at @3xs (16rem) and differ from the page breakpoints, for example @md is 28rem.

What does p-4 compile to in Tailwind v4?

padding: calc(var(--spacing) * 4). With the default --spacing of 0.25rem that is 1rem (16px at the default font size). Any whole number works on the spacing scale without configuration, and changing --spacing rescales all of them at once.

More in Guides

Start building

We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.

Product

Who It's For

Features

Resources

Company

View Sitemap