tailwind-css
  1. tailwind-css-mix-blend-mode

Tailwind CSS Mix Blend Mode

mix-blend-mode is a CSS property that is used to blend the elements with the elements beneath it. With Tailwind CSS Mix Blend Mode, we can easily apply mix-blend-mode to any element.

Syntax

To apply mix blend mode property with Tailwind CSS, use the following syntax:

<div class="mix-blend-{{mode}}"></div>

mix-blend-{{mode}} represents the blend mode. Replace {{mode}} with one of the available mode name like normal, overlay, screen, multiply, etc.

Example

Let's look at an example to understand the usage of Tailwind CSS Mix Blend Mode.

<div class="bg-gray-900 p-10">
  <h1 class="text-white mix-blend-screen">Tailwind CSS Mix Blend Mode Example</h1>
</div>

Here, we have applied the mix-blend-screen class to blend the text of heading with the background.

Output

Tailwind CSS Mix Blend Mode Output

Explanation

The mix-blend-mode CSS property determines how an element's content should blend with the content of other elements and the background. It accepts various values that change the way blending will occur.

Using Tailwind CSS, we can apply mix blend mode property by adding the mix-blend-{{mode}} class to the element, where {{mode}} represents the blend mode.

Here, we have used mix-blend-screen to blend the text of the heading with the background color.

Use

Tailwind CSS Mix Blend Mode can be used in various scenarios while designing web pages. It is especially useful for creating headings, section titles, or any other element that needs to blend with the background color.

Important Points

  • mix-blend-mode specifies how a blended element's pixel values should be mixed with the background's pixel values.
  • Supported blending modes are 'normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', and 'luminosity'.
  • The {{mode}} value must be hyphen-separated string.
  • Tailwind CSS Mix Blend Mode classes can be added to any HTML element.

Summary

Tailwind CSS Mix Blend Mode allows us to blend the elements with the elements beneath it. We can easily apply mix-blend-mode to any element with the help of Tailwind CSS classes. It is useful for designing elements that need to blend with the background color.

Published on: