What Is New in Tailwind CSS 4.1
| Category | Highlights |
|---|---|
| New Features |
|
| Improvements |
|
How can I add text shadows to headings with Tailwind CSS 4.1?
Tailwind CSS 4.1 introduces a full suite of text-shadow-* utilities that let you apply subtle or dramatic shadows directly in your markup.
- Sizes range from
text-shadow-2xstotext-shadow-lg. - Use a color modifier like
text-shadow-sky-300to change the shadow hue. - Opacity modifiers are chained with a slash, e.g.,
text-shadow-lg/50for 50 % opacity.
<p class="text-2xl font-bold text-shadow-lg text-shadow-indigo-500/30">Bold heading</p>
In practice this means you can make hero titles stand out on busy backgrounds without writing custom CSS.
What new masking utilities does Tailwind CSS 4.1 provide and how do I use them?
Tailwind CSS 4.1 adds a dedicated mask-* API that mirrors bg-* but works with mask-image and is fully composable.
- Linear side masks:
mask-t-from-50%,mask-r-to-80%, etc. - Radial and conic masks:
mask-radial-[50%_90%],mask-radial-from-80%. - Combine multiple masks on the same element for complex effects.
<div class="mask-b-from-20% mask-b-to-80% bg-[url(/img/mountains.jpg)]"></div>
This matters if you need to reveal or hide parts of an image based on design requirements without extra SVG or JS.
How does Tailwind CSS 4.1 improve browser compatibility for older browsers?
Tailwind CSS 4.1 ships with built-in fallbacks that let modern CSS features degrade gracefully in legacy browsers.
- Oklab colors now have fallback values for Safari ≤ 15.
- Properties defined with
@property(shadows, gradients, transforms) receive polyfilled equivalents. - Opacity modifiers generate inline fallback colors.
- Gradients without native interpolation fall back to the browser's default rendering.
Most teams can keep the same Tailwind config and trust that users on older iOS or Firefox still see a functional UI.
How can I control text wrapping and overflow with the new overflow-wrap utilities?
The new wrap-break-word and wrap-anywhere utilities give you fine-grained control over how long strings break.
wrap-break-wordforces a break at the end of a word, ideal for URLs.wrap-anywhereallows mid-word breaks, removing the need formin-width:0in flex children.
<p class="wrap-break-word">https://example.com/very/long/path/that/needs/wrapping</p>
This is especially useful in card components where a single long word can otherwise overflow the container.
How do the new pointer and any-pointer variants help with device-specific styling?
Tailwind CSS 4.1 adds pointer-fine, pointer-coarse, any-pointer-fine, and any-pointer-coarse variants to target mouse vs. touch input directly.
- Use
pointer-coarse:to enlarge hit targets on touch devices. - Use
pointer-fine:for tighter spacing on mouse-driven interfaces. any-pointer-*matches if any connected device meets the criteria, useful for hybrid laptops.
<div class="grid grid-cols-6 gap-2 pointer-coarse:mt-6 pointer-coarse:grid-cols-3">...</div>
Watch out for over-using these variants; they add extra CSS weight, so apply them only where the UX truly differs.
Frequently Asked Questions
Can I customize the default text-shadow sizes in Tailwind CSS 4.1?
You can extend the theme's textShadow scale in your tailwind.config.js file.
Do the mask utilities replace the need for custom CSS mask-image rules?
In most cases the mask-* utilities cover common patterns, but you can still write arbitrary mask-image values with arbitrary utilities.
Will the new overflow-wrap utilities work inside a flex container without extra CSS?
Yes wrap-anywhere handles the intrinsic size calculation, eliminating the need for min-width:0.
How do I safelist a class that is generated only at runtime?
Use @source inline("my-dynamic-class") in a CSS file to force generation.
Is there a way to disable the older-browser fallbacks if I only support modern browsers?
You can set the compatibility mode flag in the config to skip generating fallback rules.
What is the syntax for applying a colored drop-shadow with opacity?
Use drop-shadow-cyan-500/50 as a single class.