Opacity & Transparency
CSS offers two distinct ways to make things transparent: the opacity property and the alpha channel built into colour functions.
The opacity Property
opacity accepts a value between 0 (invisible) and 1 (fully opaque). Critically, it affects the entire element and all its descendants — child text and images become transparent too.
Alpha Channel in Colors
Using rgb(r g b / alpha) or hsl(h s% l% / alpha) makes only the colour transparent, leaving child elements unaffected.
When to Use Which
Use opacity for fade-in/out animations of whole components. Use alpha-channel colours when you want a semi-transparent background but opaque text inside.