Free Tailwind CSS v4 Cheat Sheet Online - Quick Reference Guide
Complete Tailwind CSS v4 cheat sheet with all utility classes. Free online quick reference guide for Tailwind v4. No signup needed.
Tailwind CSS Cheat Sheet Download Free v4 Latest
Get the complete PDF with all utilities, branding & reference URLs
blockdisplay: block;inline-blockdisplay: inline-block;inlinedisplay: inline;flexdisplay: flex;inline-flexdisplay: inline-flex;griddisplay: grid;inline-griddisplay: inline-grid;hiddendisplay: none;tabledisplay: table;table-rowdisplay: table-row;table-celldisplay: table-cell;table-captiondisplay: table-caption;table-columndisplay: table-column;table-column-groupdisplay: table-column-group;table-footer-groupdisplay: table-footer-group;table-header-groupdisplay: table-header-group;table-row-groupdisplay: table-row-group;contentsdisplay: contents;list-itemdisplay: list-item;flow-rootdisplay: flow-root;staticposition: static;fixedposition: fixed;absoluteposition: absolute;relativeposition: relative;stickyposition: sticky;containerwidth: 100%; max-width: varies;inset-0inset: 0px;inset-autoinset: auto;inset-x-0left: 0px; right: 0px;inset-y-0top: 0px; bottom: 0px;top-0top: 0px;right-0right: 0px;bottom-0bottom: 0px;left-0left: 0px;top-autotop: auto;right-autoright: auto;bottom-autobottom: auto;left-autoleft: auto;z-0z-index: 0;z-10z-index: 10;z-20z-index: 20;z-30z-index: 30;z-40z-index: 40;z-50z-index: 50;z-autoz-index: auto;-z-10z-index: -10;-z-20z-index: -20;visiblevisibility: visible;invisiblevisibility: hidden;collapsevisibility: collapse;box-borderbox-sizing: border-box;box-contentbox-sizing: content-box;box-decoration-clonev3: decoration-clonebox-decoration-break: clone;box-decoration-slicev3: decoration-slicebox-decoration-break: slice;float-leftfloat: left;float-rightfloat: right;float-nonefloat: none;float-startNEWfloat: inline-start;float-endNEWfloat: inline-end;clear-leftclear: left;clear-rightclear: right;clear-bothclear: both;clear-noneclear: none;clear-startNEWclear: inline-start;clear-endNEWclear: inline-end;isolateisolation: isolate;isolation-autoisolation: auto;object-containobject-fit: contain;object-coverobject-fit: cover;object-fillobject-fit: fill;object-noneobject-fit: none;object-scale-downobject-fit: scale-down;object-bottomobject-position: bottom;object-centerobject-position: center;object-leftobject-position: left;object-rightobject-position: right;object-topobject-position: top;object-left-bottomobject-position: left bottom;object-left-topobject-position: left top;object-right-bottomobject-position: right bottom;object-right-topobject-position: right top;overflow-autooverflow: auto;overflow-hiddenoverflow: hidden;overflow-visibleoverflow: visible;overflow-scrolloverflow: scroll;overflow-x-autooverflow-x: auto;overflow-y-autooverflow-y: auto;overflow-x-hiddenoverflow-x: hidden;overflow-y-hiddenoverflow-y: hidden;overflow-x-clipNEWoverflow-x: clip;overflow-y-clipNEWoverflow-y: clip;overscroll-autooverscroll-behavior: auto;overscroll-containoverscroll-behavior: contain;overscroll-noneoverscroll-behavior: none;overscroll-x-containoverscroll-behavior-x: contain;overscroll-y-containoverscroll-behavior-y: contain;overscroll-x-noneoverscroll-behavior-x: none;overscroll-y-noneoverscroll-behavior-y: none;aspect-autoaspect-ratio: auto;aspect-squareaspect-ratio: 1 / 1;aspect-videoaspect-ratio: 16 / 9;columns-1columns: 1;columns-2columns: 2;columns-3columns: 3;columns-4columns: 4;columns-5columns: 5;columns-6columns: 6;columns-7columns: 7;columns-8columns: 8;columns-9columns: 9;columns-10columns: 10;columns-11columns: 11;columns-12columns: 12;columns-autocolumns: auto;columns-3xsNEWcolumns: 16rem;columns-2xsNEWcolumns: 18rem;columns-xsNEWcolumns: 20rem;columns-smNEWcolumns: 24rem;columns-mdNEWcolumns: 28rem;columns-lgNEWcolumns: 32rem;columns-xlNEWcolumns: 36rem;columns-2xlNEWcolumns: 42rem;columns-3xlNEWcolumns: 48rem;columns-4xlNEWcolumns: 56rem;columns-5xlNEWcolumns: 64rem;columns-6xlNEWcolumns: 72rem;columns-7xlNEWcolumns: 80rem;break-before-autobreak-before: auto;break-before-avoidbreak-before: avoid;break-before-pagebreak-before: page;break-before-columnbreak-before: column;break-after-autobreak-after: auto;break-after-avoidbreak-after: avoid;break-after-pagebreak-after: page;break-after-columnbreak-after: column;break-inside-autobreak-inside: auto;break-inside-avoidbreak-inside: avoid;break-inside-avoid-pagebreak-inside: avoid-page;break-inside-avoid-columnbreak-inside: avoid-column;contain-noneNEWcontain: none;contain-contentNEWcontain: content;contain-strictNEWcontain: strict;contain-sizeNEWcontain: size;contain-inline-sizeNEWcontain: inline-size;contain-layoutNEWcontain: layout;contain-paintNEWcontain: paint;contain-styleNEWcontain: style;@containerNEWcontainer-type: inline-size;@container-normalNEWcontainer-type: normal;@container-sizeNEWcontainer-type: size;inset-0.5inset: 0.125rem;top-0.5top: 0.125rem;right-0.5right: 0.125rem;bottom-0.5bottom: 0.125rem;left-0.5left: 0.125rem;inset-x-0.5left: 0.125rem; right: 0.125rem;inset-y-0.5top: 0.125rem; bottom: 0.125rem;inset-1inset: 0.25rem;top-1top: 0.25rem;right-1right: 0.25rem;bottom-1bottom: 0.25rem;left-1left: 0.25rem;inset-x-1left: 0.25rem; right: 0.25rem;inset-y-1top: 0.25rem; bottom: 0.25rem;inset-2inset: 0.5rem;top-2top: 0.5rem;right-2right: 0.5rem;bottom-2bottom: 0.5rem;left-2left: 0.5rem;inset-x-2left: 0.5rem; right: 0.5rem;inset-y-2top: 0.5rem; bottom: 0.5rem;inset-4inset: 1.0rem;top-4top: 1.0rem;right-4right: 1.0rem;bottom-4bottom: 1.0rem;left-4left: 1.0rem;inset-x-4left: 1.0rem; right: 1.0rem;inset-y-4top: 1.0rem; bottom: 1.0rem;inset-8inset: 2.0rem;top-8top: 2.0rem;right-8right: 2.0rem;bottom-8bottom: 2.0rem;left-8left: 2.0rem;inset-x-8left: 2.0rem; right: 2.0rem;inset-y-8top: 2.0rem; bottom: 2.0rem;inset-12inset: 3.0rem;top-12top: 3.0rem;right-12right: 3.0rem;bottom-12bottom: 3.0rem;left-12left: 3.0rem;inset-x-12left: 3.0rem; right: 3.0rem;inset-y-12top: 3.0rem; bottom: 3.0rem;inset-16inset: 4.0rem;top-16top: 4.0rem;right-16right: 4.0rem;bottom-16bottom: 4.0rem;left-16left: 4.0rem;inset-x-16left: 4.0rem; right: 4.0rem;inset-y-16top: 4.0rem; bottom: 4.0rem;inset-20inset: 5.0rem;top-20top: 5.0rem;right-20right: 5.0rem;bottom-20bottom: 5.0rem;left-20left: 5.0rem;inset-x-20left: 5.0rem; right: 5.0rem;inset-y-20top: 5.0rem; bottom: 5.0rem;inset-24inset: 6.0rem;top-24top: 6.0rem;right-24right: 6.0rem;bottom-24bottom: 6.0rem;left-24left: 6.0rem;inset-x-24left: 6.0rem; right: 6.0rem;inset-y-24top: 6.0rem; bottom: 6.0rem;inset-32inset: 8.0rem;top-32top: 8.0rem;right-32right: 8.0rem;bottom-32bottom: 8.0rem;left-32left: 8.0rem;inset-x-32left: 8.0rem; right: 8.0rem;inset-y-32top: 8.0rem; bottom: 8.0rem;inset-40inset: 10.0rem;top-40top: 10.0rem;right-40right: 10.0rem;bottom-40bottom: 10.0rem;left-40left: 10.0rem;inset-x-40left: 10.0rem; right: 10.0rem;inset-y-40top: 10.0rem; bottom: 10.0rem;inset-48inset: 12.0rem;top-48top: 12.0rem;right-48right: 12.0rem;bottom-48bottom: 12.0rem;left-48left: 12.0rem;inset-x-48left: 12.0rem; right: 12.0rem;inset-y-48top: 12.0rem; bottom: 12.0rem;inset-56inset: 14.0rem;top-56top: 14.0rem;right-56right: 14.0rem;bottom-56bottom: 14.0rem;left-56left: 14.0rem;inset-x-56left: 14.0rem; right: 14.0rem;inset-y-56top: 14.0rem; bottom: 14.0rem;inset-64inset: 16.0rem;top-64top: 16.0rem;right-64right: 16.0rem;bottom-64bottom: 16.0rem;left-64left: 16.0rem;inset-x-64left: 16.0rem; right: 16.0rem;inset-y-64top: 16.0rem; bottom: 16.0rem;inset-72inset: 18.0rem;top-72top: 18.0rem;right-72right: 18.0rem;bottom-72bottom: 18.0rem;left-72left: 18.0rem;inset-x-72left: 18.0rem; right: 18.0rem;inset-y-72top: 18.0rem; bottom: 18.0rem;inset-80inset: 20.0rem;top-80top: 20.0rem;right-80right: 20.0rem;bottom-80bottom: 20.0rem;left-80left: 20.0rem;inset-x-80left: 20.0rem; right: 20.0rem;inset-y-80top: 20.0rem; bottom: 20.0rem;inset-96inset: 24.0rem;top-96top: 24.0rem;right-96right: 24.0rem;bottom-96bottom: 24.0rem;left-96left: 24.0rem;inset-x-96left: 24.0rem; right: 24.0rem;inset-y-96top: 24.0rem; bottom: 24.0rem;flex-rowflex-direction: row;flex-row-reverseflex-direction: row-reverse;flex-colflex-direction: column;flex-col-reverseflex-direction: column-reverse;flex-wrapflex-wrap: wrap;flex-wrap-reverseflex-wrap: wrap-reverse;flex-nowrapflex-wrap: nowrap;flex-1flex: 1 1 0%;flex-autoflex: 1 1 auto;flex-initialflex: 0 1 auto;flex-noneflex: none;growv3: flex-growflex-grow: 1;grow-0v3: flex-grow-0flex-grow: 0;shrinkv3: flex-shrinkflex-shrink: 1;shrink-0v3: flex-shrink-0flex-shrink: 0;order-firstorder: -9999;order-lastorder: 9999;order-noneorder: 0;order-1order: 1;-order-1order: -1;order-2order: 2;-order-2order: -2;order-3order: 3;-order-3order: -3;order-4order: 4;-order-4order: -4;order-5order: 5;-order-5order: -5;order-6order: 6;-order-6order: -6;order-7order: 7;-order-7order: -7;order-8order: 8;-order-8order: -8;order-9order: 9;-order-9order: -9;order-10order: 10;-order-10order: -10;order-11order: 11;-order-11order: -11;order-12order: 12;-order-12order: -12;basis-0flex-basis: 0.0rem;basis-0.5flex-basis: 0.125rem;basis-1flex-basis: 0.25rem;basis-1.5flex-basis: 0.375rem;basis-2flex-basis: 0.5rem;basis-2.5flex-basis: 0.625rem;basis-3flex-basis: 0.75rem;basis-3.5flex-basis: 0.875rem;basis-4flex-basis: 1.0rem;basis-5flex-basis: 1.25rem;basis-6flex-basis: 1.5rem;basis-8flex-basis: 2.0rem;basis-10flex-basis: 2.5rem;basis-12flex-basis: 3.0rem;basis-16flex-basis: 4.0rem;basis-20flex-basis: 5.0rem;basis-24flex-basis: 6.0rem;basis-32flex-basis: 8.0rem;basis-40flex-basis: 10.0rem;basis-48flex-basis: 12.0rem;basis-56flex-basis: 14.0rem;basis-64flex-basis: 16.0rem;basis-72flex-basis: 18.0rem;basis-80flex-basis: 20.0rem;basis-96flex-basis: 24.0rem;basis-1/2flex-basis: 1/2;basis-1/3flex-basis: 1/3;basis-2/3flex-basis: 2/3;basis-1/4flex-basis: 1/4;basis-2/4flex-basis: 2/4;basis-3/4flex-basis: 3/4;basis-1/5flex-basis: 1/5;basis-2/5flex-basis: 2/5;basis-3/5flex-basis: 3/5;basis-4/5flex-basis: 4/5;basis-1/6flex-basis: 1/6;basis-2/6flex-basis: 2/6;basis-3/6flex-basis: 3/6;basis-4/6flex-basis: 4/6;basis-5/6flex-basis: 5/6;basis-1/12flex-basis: 1/12;basis-5/12flex-basis: 5/12;basis-7/12flex-basis: 7/12;basis-11/12flex-basis: 11/12;basis-autoflex-basis: auto;basis-fullflex-basis: 100%;Tailwind CSS v4 rewrote the framework from the ground up. The configuration file is gone, replaced by CSS-first directives like @theme and @source. The color system moved from HSL to OKLCH. New utilities like 3D transforms, container queries, and field sizing landed alongside dozens of renamed and removed classes. If you are upgrading an existing project or starting fresh with v4, having every class, every new feature, and every breaking change in one searchable reference saves you from constantly switching between the official docs and your editor. This cheat sheet covers all of it: the complete utility class reference organized by category, the new CSS-first configuration system, the v3-to-v4 migration differences, and practical examples you can copy directly into your project.
Table of Contents
How to Use This Tailwind v4 Cheat Sheet
Search by class name or CSS property
Type any Tailwind utility class like flex, bg-sky-500, or md:grid-cols-3 into the search bar and the cheat sheet instantly filters to show matching results. You can also search by CSS property name like display, background-color, or grid-template-columns. The search works in both directions, so you can go from CSS to Tailwind or Tailwind to CSS depending on what you already know.
Browse categories with live preview
The cheat sheet organizes every utility into logical categories: Layout, Flexbox and Grid, Spacing, Sizing, Typography, Backgrounds, Borders, Effects, Filters, Tables, Transitions and Animation, Transforms, Interactivity, SVG, and Accessibility. Click any category to expand it and see every class alongside a live visual preview that shows exactly what that class does. No more guessing what ring-2 looks like versus ring-4.
Copy classes with one click
Every class in the cheat sheet has a copy button next to it. Click once and the class name lands on your clipboard, ready to paste into your HTML or JSX. For classes that take arbitrary values like w-[320px] or text-[#1a1a2e], the cheat sheet shows both the standard scale values and the arbitrary value syntax so you know your options.
Save your frequently used classes
The Saved tab stores the classes you use most often. Add any class from the reference, and it persists in your browser's local storage. This is useful for teams that share a common design system or for developers who always reach for the same set of spacing, color, and typography classes. Your saved data never leaves your device.
Explore v4-specific new features
The New in v4 tab highlights every utility, feature, and syntax change that landed in Tailwind CSS v4. This includes 3D transform utilities like rotate-x-45 and perspective-dramatic, container query utilities like @container and sm:@lg:grid-cols-2, the OKLCH color palette, field-sizing utilities, inset shadow classes, and the CSS-first configuration system using @theme, @source, @utility, and @variant directives. Every new feature includes an example and a link to the relevant section in the official documentation.
What Is New in Tailwind CSS v4: The Complete Breakdown
Tailwind v3 vs v4: What Changed, What Moved, What Disappeared
Configuration moved from JavaScript to CSS
In v3, you customized Tailwind through tailwind.config.js with a content array, theme.extend, and plugins. In v4, all of this happens in your CSS file. Use @theme { } to define design tokens, @source to specify content paths, and @utility to create custom utilities. There is no more tailwind.config.js. If you have an existing config, Tailwind provides a migration tool (npx @tailwindcss/upgrade) that converts your JavaScript config into CSS @theme directives automatically.
Color opacity syntax changed
V3 used separate opacity utilities like bg-opacity-50 alongside color utilities like bg-blue-500. V4 removes the opacity utilities entirely. Instead, you use the slash syntax directly on the color class: bg-blue-500/50 gives you blue-500 at 50% opacity. This applies to text colors (text-red-600/80), border colors (border-gray-300/40), and every other color property. The old bg-opacity-* classes no longer exist.
Ring utilities replaced by shadow utilities
V3 had ring, ring-offset, and ring-opacity utilities that created box-shadow-based outlines. V4 replaces these with the more general shadow-* utilities and the outline-* utilities. If you used ring-2 ring-blue-500 in v3, you can use shadow-[0_0_0_2px_theme(colors.blue.500)] or the new outline utilities in v4. The ring-* classes have been deprecated.
Theme values use CSS variables
V4 exposes every theme value as a CSS custom property. The spacing scale is available as var(--spacing), colors as var(--color-blue-500), and so on. This means you can reference Tailwind theme values in your own CSS, in JavaScript, or in any context where you need a specific token. In v3, accessing theme values required the theme() function in your config or arbitrary values like bg-[theme(colors.blue.500)].
New @variant directive replaces plugins
Custom variants in v3 required writing a JavaScript plugin with addVariant(). In v4, you define variants directly in CSS using @variant. For example, @variant hocus (&:hover, &:focus) creates a hocus: modifier that applies styles on both hover and focus. This is simpler, more readable, and stays within the CSS ecosystem.
Default border color changed
In v3, the default border color was gray-200. In v4, the default is the current text color (currentColor), which matches how CSS borders work natively. If you relied on the gray default, you now need to explicitly add border-gray-200 to your elements.
New arbitrary value syntax
V4 expands the arbitrary value system with a cleaner syntax. Properties that accept CSS custom properties can now use the parenthesized syntax: aspect-(--my-ratio) reads a CSS variable directly, and w-(--sidebar-width) does the same for widths. This is shorter and more readable than the bracket syntax w-[var(--sidebar-width)] used in v3.
Tailwind v4 CSS-First Configuration: @theme, @source, @utility, @variant
Tailwind v4 New Utility Classes Reference
3D Transform Utilities (New in v4)
| Class | CSS Property | Description |
|---|---|---|
| rotate-x-* | transform: rotateX(*) | Rotate element around X axis (3D) |
| rotate-y-* | transform: rotateY(*) | Rotate element around Y axis (3D) |
| rotate-z-* | transform: rotateZ(*) | Rotate element around Z axis (alias for rotate-*) |
| scale-x-* | transform: scaleX(*) | Scale element along X axis |
| scale-y-* | transform: scaleY(*) | Scale element along Y axis |
| scale-z-* | transform: scaleZ(*) | Scale element along Z axis (3D) |
| scale-3d | transform: scale3d() | Enable 3D scaling context |
| translate-z-* | transform: translateZ(*) | Translate element along Z axis (3D) |
| perspective-* | perspective: * | Set perspective distance for 3D transforms |
| perspective-origin-* | perspective-origin: * | Set vanishing point for 3D perspective |
| transform-3d | transform-style: preserve-3d | Enable 3D transform context on children |
| transform-flat | transform-style: flat | Flatten children into 2D plane |
| backface-visible | backface-visibility: visible | Show element when facing away |
| backface-hidden | backface-visibility: hidden | Hide element when facing away |
Container Query Utilities (New in v4)
| Class | CSS Property | Description |
|---|---|---|
| @container | container-type: inline-size | Define a container query context |
| @container-* | container-name: * | Name a container for targeted queries |
| sm:@container | @container (min-width: 640px) | Container query at small size |
| md:@container | @container (min-width: 768px) | Container query at medium size |
| lg:@container | @container (min-width: 1024px) | Container query at large size |
Other New Utilities in v4
| Class | CSS Property | Description |
|---|---|---|
| field-sizing-content | field-sizing: content | Auto-size textareas to content |
| field-sizing-fixed | field-sizing: fixed | Fixed size form fields (default) |
| inset-shadow-* | box-shadow: inset * | Inner shadow utilities |
| inset-ring-* | box-shadow: inset 0 0 0 * | Inner ring utilities |
| text-wrap-pretty | text-wrap: pretty | Prevent orphans in last line |
| text-wrap-balance | text-wrap: balance | Balance lines of text evenly |
| text-wrap-auto | text-wrap: auto | Default text wrapping behavior |
| stroke-w-* | stroke-width: * | SVG stroke width utility |
Real-World Tailwind v4 Code Examples
3D Card Flip Effect
Combine perspective-*, transform-3d, rotate-y-180, and backface-hidden to create a card that flips when hovered. The parent gets perspective-dramatic to set the 3D viewing distance, and each face uses backface-hidden to hide when facing away. This was impossible with Tailwind v3 utilities alone and required custom CSS.
Container Query Responsive Sidebar
Use @container on a parent element and sm:@lg:flex-row on a child to create a sidebar that switches from stacked to side-by-side based on the parent's width, not the viewport. This is the key advantage of container queries over media queries: the same component adapts to its container, whether it is in a wide dashboard layout or a narrow sidebar panel.
CSS-First Theme Configuration
Replace your entire tailwind.config.js with @theme { --color-brand: oklch(0.7 0.15 250); --font-heading: 'Inter', sans-serif; --radius-btn: 0.5rem; } inside your main CSS file. Now bg-brand, font-heading, and rounded-btn work as native Tailwind utilities. No JavaScript, no plugins, no build step configuration. The theme values are CSS variables that you can also reference in your own styles.
Auto-Sizing Textarea with field-sizing-content
Apply field-sizing-content to a textarea element and it automatically grows to fit its content as the user types. No JavaScript resize observer needed. The textarea shrinks back when text is deleted. This is a native CSS feature that Tailwind v4 exposes as a utility class, solving one of the most common frontend annoyances with a single class.
OKLCH Color Palette with Perceptual Uniformity
V4's default color palette uses OKLCH instead of HSL, which means each shade in a color scale appears equally distant from its neighbors to the human eye. bg-blue-500 and bg-red-500 have the same perceived lightness, making your designs feel more balanced. You can also define custom OKLCH colors in @theme that maintain this uniformity across your entire palette.
Common Mistakes When Using Tailwind v4
Using v3 class names that no longer exist
Classes like bg-opacity-50, ring-2, ring-offset-2, placeholder-purple-300, and divide-gray-200 either changed syntax or were removed in v4. Running npx @tailwindcss/upgrade on your project catches most of these automatically, but it misses dynamic class names constructed with string concatenation. Search your codebase for these patterns and update them manually after running the migration tool.
Forgetting to replace tailwind.config.js with @theme
If you delete tailwind.config.js without migrating your customizations into @theme blocks in your CSS file, all your custom colors, fonts, spacing, and breakpoints disappear silently. The upgrade tool handles this conversion, but only if you run it before deleting the config. Always run npx @tailwindcss/upgrade first, verify the output, and then remove the old config file.
Mixing v3 and v4 syntax in the same project
Using @tailwind base/components/utilities directives alongside @import 'tailwindcss' causes conflicts. V4 uses the single import syntax, and the old triple-directive syntax is removed. Choose one approach and stick with it. If you are on v4, use only @import 'tailwindcss' and remove any @tailwind directives from your CSS.
Not updating the content path configuration
V3 used the content array in tailwind.config.js. V4 uses @source directives in CSS or autodetects content paths. If your v4 project is missing styles in production, it is likely because the @source paths do not cover all your template files. Check that your @source patterns match every directory where you use Tailwind classes, including component libraries and node_modules packages.
Expecting default border colors to match v3
V4 changed the default border color from gray-200 to currentColor. This means borders inherit the text color by default, which is how CSS borders work natively but differs from v3. If your design depends on gray borders, add border-gray-200 explicitly to elements that need it.
Best Practices for Working with Tailwind v4
Keep all configuration in one CSS file
V4's CSS-first approach means your entire Tailwind configuration lives in your main CSS file. Resist the temptation to split @theme blocks across multiple files. One CSS file with all @theme, @source, @utility, and @variant directives makes it easy for any team member to find and modify design tokens. If the file gets large, use CSS comments to organize sections by category (colors, spacing, typography, etc.).
Use OKLCH colors for perceptual uniformity
When defining custom colors in @theme, prefer OKLCH values over HEX or RGB. OKLCH produces color scales where each step appears equally different to the human eye, unlike HSL where blue-500 and yellow-500 at the same lightness value look dramatically different in perceived brightness. This makes your design system feel more cohesive and accessible.
Leverage container queries for component-level responsiveness
Container queries let components respond to their own width instead of the viewport width. This means a sidebar card component and a main content card component can share the same code but adapt differently based on their container. Use @container on parent elements and sm:@container, md:@container modifiers on children. This pattern reduces code duplication and makes components truly portable.
Use the slash syntax for color opacity everywhere
The v3 pattern of separate opacity utilities (bg-opacity-50, text-opacity-80) is gone. The v4 slash syntax (bg-blue-500/50, text-gray-900/80) is more concise, more readable, and combines the color and opacity into a single token. Adopt this pattern consistently across your project for cleaner class lists and easier visual scanning.
Run the upgrade tool before manual migration
The npx @tailwindcss/upgrade command handles the most tedious parts of v3-to-v4 migration: converting tailwind.config.js to @theme, updating class names that changed syntax, and replacing deprecated utilities. Run it first, review the changes, and then manually handle edge cases like dynamically constructed class names and third-party component libraries that bundle v3 classes.