When `opacity-*` (e.g., `opacity-60`) is applied to an element, it affects the entire element, including its background, text, and any child elements. This can make text hard to read if you only wanted a semi-transparent background.
This text is also 60% opaque, just like the indigo background. This is often not the desired effect for readability.
To make only the background semi-transparent while keeping the text and child elements fully opaque, use background opacity utilities like `bg-color/opacity` (e.g., `bg-indigo-600/60`) or `bg-color bg-opacity-*` (e.g., `bg-indigo-600 bg-opacity-60`).
This text is fully opaque, while the indigo background is 60% opaque. This is usually the desired effect for overlays or subtle backgrounds.
Another way to achieve the same result (older Tailwind syntax or for more complex scenarios):
This text is also fully opaque. The teal background has 50% opacity using `bg-opacity-50`.
Overlay Text (Readable)