Reputation: 91
I just want add a dark overlay for my div background. I add black as a background color and set opacity to 0.5 But the problem is that child element divs also apply that opacity. See my screenshot. I just want to add that overlay for my parent div background only. Is there any specific way of doing this?
Upvotes: 1
Views: 976
Reputation: 53208
You can use a semi-transparent PNG file as the background image, or just use the RGBA
colour system:
background: rgba(0,0,0,.5);
rgba()
is supported in all modern browser.
Upvotes: 2