Opacity modifiers let you make colors see-through. This helps create layers and softer looks on your website.
Opacity modifiers on colors in Tailwind
bg-color/opacity text-color/opacity border-color/opacity
Opacity is added after a slash / following the color name.
Opacity values go from 0 (fully transparent) to 100 (fully solid).
bg-blue-500/50text-red-600/75border-green-400/30This page shows three examples: a blue box with half opacity background, red text with 75% opacity, and a button with a faint green border at 30% opacity. The button border becomes fully green on hover.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Opacity Modifiers Example</title> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="flex flex-col items-center justify-center min-h-screen gap-6 bg-gray-100 p-6"> <div class="w-64 h-24 bg-blue-500/50 flex items-center justify-center rounded"> <p class="text-white font-semibold">Blue 50% opacity</p> </div> <p class="text-red-600/75 font-bold text-lg">Red text 75% opacity</p> <button class="border-4 border-green-400/30 px-6 py-2 rounded hover:border-green-400 transition"> Green border 30% opacity </button> </body> </html>
Opacity modifiers only affect the color they are attached to, not the whole element.
You can combine opacity modifiers with hover or focus states for interactive effects.
Using opacity modifiers keeps your colors consistent but flexible in transparency.
Opacity modifiers add transparency to Tailwind colors using a slash and number.
Values range from 0 (invisible) to 100 (fully visible).
They help create layered, softer, or interactive color effects easily.