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