Mix blend modes let you combine colors of overlapping elements in interesting ways. This helps create cool visual effects on your webpage.
Mix blend modes in Tailwind
mix-blend-{mode}Replace {mode} with the blend mode name like multiply, screen, or overlay.
Tailwind provides utilities for common blend modes to use directly in your HTML classes.
<div class="mix-blend-multiply">...</div><div class="mix-blend-screen">...</div><div class="mix-blend-overlay">...</div>This example shows a photo with a pink overlay that uses mix-blend-multiply. The pink color blends with the photo, making a darker tinted effect behind the white text.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Mix Blend Modes Example</title> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="flex items-center justify-center min-h-screen bg-gray-200"> <div class="relative w-64 h-64 bg-yellow-300"> <img src="https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=256&q=80" alt="Nature" class="w-full h-full object-cover" /> <div class="absolute inset-0 bg-pink-500 mix-blend-multiply"></div> <div class="absolute inset-0 flex items-center justify-center text-white font-bold text-2xl"> Hello </div> </div> </body> </html>
Mix blend modes depend on the colors behind the element, so results can change with different backgrounds.
Not all blend modes work well on all browsers; test your design on major browsers.
Use semantic HTML and ensure text remains readable when using blend modes.
Mix blend modes let you combine colors of overlapping elements for creative effects.
Tailwind CSS provides easy classes like mix-blend-multiply to apply these effects.
Use them to enhance visuals while keeping your design accessible and readable.