HTML & CSS · Junior · Question 62 of 75
How does opacity: 0.5 on a card differ from background: rgb(0 0 0 / 0.5)?
- ✓Correct answer:
opacitymakes the whole element including text and children translucent; an alpha color affects only the background - 2They look the same
- 3
opacityonly affects the background
Explanation
Use alpha in colors when only the background should be see-through. Note that opacity below 1 also creates a new stacking context.