Background Blend Mode
Tailwind CSS version
v2.1+
Utilities for controlling how an element’s background image should blend with its background color.
Default class reference
Class | Properties |
---|---|
bg-blend-normal | background-blend-mode: normal; |
bg-blend-multiply | background-blend-mode: multiply; |
bg-blend-screen | background-blend-mode: screen; |
bg-blend-overlay | background-blend-mode: overlay; |
bg-blend-darken | background-blend-mode: darken; |
bg-blend-lighten | background-blend-mode: lighten; |
bg-blend-color-dodge | background-blend-mode: color-dodge; |
bg-blend-color-burn | background-blend-mode: color-burn; |
bg-blend-hard-light | background-blend-mode: hard-light; |
bg-blend-soft-light | background-blend-mode: soft-light; |
bg-blend-difference | background-blend-mode: difference; |
bg-blend-exclusion | background-blend-mode: exclusion; |
bg-blend-hue | background-blend-mode: hue; |
bg-blend-saturation | background-blend-mode: saturation; |
bg-blend-color | background-blend-mode: color; |
bg-blend-luminosity | background-blend-mode: luminosity; |
Usage
Use the bg-blend-{mode}
utilities to control how an element’s background image should be blended its background color.
<div class="bg-blend-multiply ...">
<!-- ... -->
</div>
Responsive
To control the background-blend-mode property at a specific breakpoint, add a {screen}:
prefix to any existing background-blend-mode utility. For example, use md:bg-blend-darken
to apply the bg-blend-darken
utility at only medium screen sizes and above.
<div class="bg-blend-lighten md:bg-blend-darken ...">
<!-- ... -->
</div>
For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.
Customizing
Variants
By default, only responsive variants are generated for background-blend-mode utilities.
You can control which variants are generated for the background-blend-mode utilities by modifying the backgroundBlendMode
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: {
// ...
+ backgroundBlendMode: ['hover', 'focus'],
}
}
}
Disabling
If you don’t plan to use the background-blend-mode utilities in your project, you can disable them entirely by setting the backgroundBlendMode
property to false
in the corePlugins
section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ backgroundBlendMode: false,
}
}