What Is New in Tailwind CSS 1.7
| Category | Highlights |
|---|---|
| New Features | Background gradients, background-clip utilities, new gap-x / gap-y utilities, contents display, @apply with variants (experimental), default letter-spacing per font-size, divide border styles, full config access in plugins, color values as closures |
| Deprecations | Old col-gap- and row-gap- utilities are deprecated in favor of gap-x- and gap-y- |
| Breaking Changes | Experimental defaults for line-height per font-size, extended spacing scale, and extended font-size scale can change layout if enabled |
How can I add background gradients using Tailwind CSS 1.7?
Tailwind 1.7 ships with built-in gradient utilities that let you create linear gradients directly in your markup.
- Use
bg-gradient-to-{direction}to set the gradient direction. - Combine
from-,via-, andto-color stops to define up to three colors.
<div class="bg-gradient-to-r from-orange-400 via-red-500 to-pink-500">
</div>
In practice this replaces custom CSS background-image rules and works with responsive variants out of the box.
What new utilities let me clip backgrounds or create gradient text?
Tailwind 1.7 adds a backgroundClip core plugin with four utilities for controlling the background-clip property.
bg-clip-border→background-clip: border-boxbg-clip-padding→background-clip: padding-boxbg-clip-content→background-clip: content-boxbg-clip-text→background-clip: text
<h1 class="text-6xl font-bold">
<span class="bg-clip-text text-transparent bg-gradient-to-r from-teal-400 to-blue-500">
Gradient Text
</span>
</h1>
These utilities are responsive by default, so you can switch clipping modes at different breakpoints without extra CSS.
How do I migrate from the old gap utilities to the new gap-x / gap-y syntax?
The old col-gap-{n} and row-gap-{n} classes are still available but will be removed in v2.0.
- Replace
col-gap-4 row-gap-2withgap-x-4 gap-y-2. - Enable the future flag to drop the deprecated utilities early:
// tailwind.config.js
module.exports = {
future: {
removeDeprecatedGapUtilities: true,
},
}
Watch out for console warnings until the flag is set; they help you catch any missed class names during migration.
Can I use @apply with responsive and pseudo-class variants in Tailwind 1.7?
Yes, the experimental applyComplexClasses flag unlocks @apply support for variants and complex class combinations.
.btn {
@apply bg-indigo-600 hover:bg-indigo-700 sm:text-lg;
}
Enable it in your config:
// tailwind.config.js
module.exports = {
experimental: {
applyComplexClasses: true,
},
}
This matters if you want to keep component styles in a single CSS rule while still leveraging Tailwind's responsive and state variants.
Frequently Asked Questions
Does Tailwind 1.7 support gradient backgrounds out of the box?
Yes it provides bg-gradient-to-{direction} utilities combined with from-, via-, and to-color classes.
How do I enable the new gap-x and gap-y utilities?
They are available by default; just replace col-gap- and row-gap- classes with gap-x- and gap-y- equivalents.
What flag removes the deprecated col-gap- and row-gap- utilities?
Set future.removeDeprecatedGapUtilities to true in tailwind.config.js.
Can I use @apply with hover and responsive variants in this release?
Yes by enabling the experimental applyComplexClasses flag in the config.
How do I define a color that respects Tailwind's opacity utilities?
Define the color as a function that receives an opacityVariable, e.g. primary: ({opacityVariable}) => `rgba(var(--color-primary), var(${opacityVariable}, 1))`.
Are the new background-clip utilities responsive by default?
Yes the backgroundClip core plugin ships with responsive variants enabled out of the box.