Tailwind CSS v4 is the biggest update in the framework's history. Built on a new Rust-powered engine (Lightning CSS), it delivers up to 10x faster builds, zero-config content detection, and a CSS-first configuration approach that simplifies everything.
⚡ What's New in Tailwind CSS v4
- Lightning CSS Engine — Rust-powered, 10x faster builds
- Zero Config — Automatic content detection, no config file needed
- CSS-First Configuration — Use @theme in CSS instead of JS config
- New @starting-style — Native CSS entry animations
- Container Queries — Built-in @container support
- Wide Gamut Colors — oklch() and P3 color space
🎨 CSS-First Configuration
/* styles.css — No tailwind.config.js needed! */
@import "tailwindcss";
@theme {
--color-brand: oklch(0.65 0.24 265);
--color-brand-light: oklch(0.85 0.15 265);
--font-display: "Cal Sans", sans-serif;
--font-body: "Inter", sans-serif;
--breakpoint-3xl: 1920px;
--ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
/* Custom utilities */
@utility glass {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.2);
}
@utility text-balance {
text-wrap: balance;
}
🆕 Container Queries
<!-- Parent defines the container -->
<div class="@container">
<div class="flex flex-col @md:flex-row @lg:grid @lg:grid-cols-3">
<!-- Responds to container size, not viewport! -->
<div class="p-4 @sm:p-6 @md:p-8">
<h2 class="text-lg @md:text-2xl @lg:text-3xl">
Responsive to container
</h2>
</div>
</div>
</div>
✨ Entry Animations with @starting-style
/* Elements animate IN when they first render */
.card {
@apply opacity-100 translate-y-0 transition-all duration-500;
@starting-style {
@apply opacity-0 translate-y-4;
}
}
/* No JavaScript needed for entry animations! */
📊 v3 vs v4 Comparison
| Feature | v3 | v4 |
|---|---|---|
| Engine | PostCSS (JS) | Lightning CSS (Rust) |
| Build Speed | ~300ms | ~30ms (10x faster) |
| Configuration | tailwind.config.js | CSS @theme directive |
| Content Detection | Manual config | Automatic |
| Container Queries | Plugin needed | Built-in |
🚀 Migration Tip: Use the official
npx @tailwindcss/upgrade codemod to automatically migrate your v3 project. Most projects can upgrade in under 10 minutes.