Open In App

Tailwind CSS Mix Blend Mode

This class accepts lots of value in Tailwind CSS in which all the properties are covered in class form. This class is used to specify how an element’s content should be blended with the background. In CSS, we can do that by using the CSS mix-blend-mode property.

Mix Blend Mode classes :



Syntax :

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

Note: The mix-blend-mode CSS property sets how an element’s content should blend with the content of the element’s parent and the element’s background.



 

Example 1: The following code uses classes mix-blend-normal, mix-blend-multiply, mix-blend-overlay.




<!DOCTYPE html>
<html>
  
<head>
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"
        rel="stylesheet">
</head>
  
<body>
    <div class="m-auto bg-pink-100 w-2/6 h-25 p-3">
        <h3 class="text-center">
            mix-blend-mode
        </h3>
  
  
        <div class="mix-blend-normal p-8">
            <h1>normal</h1>
            <img src=
        </div>
  
        <div class="mix-blend-multiply p-8">
            <h1>multiply</h1>
            <img src=
        </div>
  
        <div class="mix-blend-overlay p-8">
            <h1>overlay</h1>
            <img src=
        </div>
    </div>
</body>
  
</html>

Output:

Example 2: The following code uses mix-blend-exclusion, mix-blend-color-burn and mix-blend-hard-light.




<!DOCTYPE html>
<html>
  
<head>
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"
        rel="stylesheet">
</head>
  
<body>
    <div class="m-auto bg-pink-100 w-2/6 h-25 p-3">
        <h1 class="text-center text-xl ">
            mix-blend-mode
        </h1>
  
        <div class="mix-blend-color-burn  p-8">
            <h1>color-burn</h1>
            <img class="h-35" src=
        </div>
  
        <div class="mix-blend-hard-light p-8">
            <h1>hard-light</h1>
            <img class="h-40" src=
        </div>
  
        <div class="mix-blend-exclusion p-8">
            <h1>exclusion</h1>
            <img class="h-40" src=
        </div>
    </div>
</body>
  
</html>

Output:


Article Tags :