Tailwind CSS version 4 introduces several significant enhancements over version 3, focusing on performance, configuration simplicity, and modern web standards. Key differences include:
1. Performance Improvements with the Oxide Engine:
Version 4 features the new Oxide engine, a ground-up rewrite designed for speed and efficiency. Full builds are up to 5 times faster, and incremental builds can be over 100 times faster, completing in microseconds[1].
2. CSS-First Configuration:
Moving away from JavaScript-based configuration files, Tailwind CSS v4 allows developers to define customizations directly within CSS using the @theme directive. This approach streamlines the setup process and reduces the need for additional configuration files[1].
3. Unified Toolchain:
Version 4 integrates Lightning CSS, providing built-in support for @import handling, vendor prefixing, and modern syntax transformations without requiring additional tools like postcss-import or autoprefixer[1].
4. Automatic Content Detection:
Tailwind CSS v4 introduces zero-configuration content detection, automatically identifying template files in your project. This eliminates the need to manually specify content paths, simplifying the setup process[1].
5. Enhanced Color Palette:
The default color palette has been upgraded to use the oklch color space, offering more vivid and consistent colors across different displays. This change leverages the wider gamut of modern display technologies[1].
6. Built-in Container Queries:
Version 4 includes native support for container queries, allowing styles to adapt based on the size of a container rather than the viewport. This feature enhances responsive design capabilities without relying on external plugins[1].
7. Expanded Gradient Utilities:
Tailwind CSS v4 introduces support for radial and conic gradients, along with new utilities for gradient interpolation modes and angles, providing more flexibility in creating complex gradient designs[1].
8. New Variants and Utilities:
The update adds several new variants and utilities, including:
not-* Variant: Allows styling elements that do not match a specific state or condition.
in-* Variant: Targets elements inside a parent with a specific state.
inert Variant: Styles non-interactive elements marked with the inert attribute.
- 3D Transform Utilities: Enables 3D transformations like
rotate-x-*, rotate-y-*, and translate-z-*.
These additions provide more granular control over styling and interactivity[1].
Overall, Tailwind CSS v4 focuses on enhancing performance, simplifying configuration, and embracing modern web standards, offering a more efficient and flexible framework compared to version 3.