Nearby lessons
57 of 61Tailwind CSS - Opacity
Overview
Tailwind provides opacity utilities to control how transparent an element looks. You can apply opacity to text, backgrounds, borders, shadows, and entire elements.
Element Opacity
Use the opacity-{value} utilities to change the transparency of the whole element.
opacity-0- Fully transparentopacity-25- 25% visibleopacity-50- 50% visibleopacity-75- 75% visibleopacity-100- Fully visible
Opacity With Color Utilities
Tailwind also supports slash opacity syntax on many color utilities.
For example, bg-blue-500/50 gives you a blue background at 50% opacity.
Similar syntax works for text, borders, rings, shadows, and outline colors.
Common Use Cases
- Disabled or inactive UI states
- Overlay backdrops and modals
- Subtle borders and dividers
- Hover and focus transitions
Best Practice
Use opacity carefully so text remains readable and interactive controls stay accessible. For important text, avoid reducing opacity too much.