Utilities for applying backdrop invert filters to an element.
Use the backdrop-invert
and backdrop-invert-0
utilities alongside the backdrop-filter
utility to whether an element should be rendered with inverted backdrop colors or normally.
<div class="backdrop-filter backdrop-invert ...">
<!-- ... -->
</div>
To control an element’s backdrop invert filter at a specific breakpoint, add a {screen}:
prefix to any existing backdrop invert utility. For example, use md:backdrop-invert-0
to apply the backdrop-invert-0
utility at only medium screen sizes and above.
<div class="backdrop-filter backdrop-invert md:backdrop-invert-0 ...">
<!-- ... -->
</div>
For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.
You can customize which backdrop-invert
utilities are generated using the backdropInvert
key in the theme
section of your tailwind.config.js
file.
// tailwind.config.js
module.exports = {
theme: {
+ extend: {
+ backdropInvert: {
+ 25: '.25',
+ 75: '.75',
+ }
+ }
}
}
Learn more about customizing the default theme in the theme customization documentation.
By default, only responsive variants are generated for backdrop invert utilities.
You can control which variants are generated for the backdrop invert utilities by modifying the backdropInvert
property in the variants
section of your tailwind.config.js
file.
For example, this config will also generate hover and focus variants:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
+ backdropInvert: ['hover', 'focus'],
}
}
}
If you don't plan to use the backdrop invert utilities in your project, you can disable them entirely by setting the backdropInvert
property to false
in the corePlugins
section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ backdropInvert: false,
}
}