--- description: Read before writing any Tailwind CSS to understand the latest v4 features. --- # Tailwind CSS v4 Development Practices ## Core Philosophy - CSS-first configuration via `@theme` directive (no `tailwind.config.js`) - Native CSS features: cascade layers, `@property`, `color-mix()`, logical properties - Automatic content detection ## Setup ```css @import "tailwindcss"; ``` ## @theme Configuration ### Define Tokens ```css @theme { --color-brand: oklch(0.72 0.11 178); --font-display: "Inter", sans-serif; --breakpoint-tablet: 640px; } ``` → Use as: `bg-brand`, `font-display` ### Multi-theme Pattern ```css @theme inline { --color-primary: var(--primary); } :root { --primary: #3b82f6; } .dark { --primary: #60a5fa; } ``` Use `@theme inline` for runtime variable resolution. ### Rules - Keep @theme variables flat (top-level only) - No nesting in @media or selectors - Use :root for non-Tailwind CSS variables ## v4 Features ### Native Opacity ```html