Reputation: 93
So i placed an image tag in my HTML doc and it seemed to inherit the opacity from the parent div element. I have tried many methods to change this but it will not work. An example:
<div style="opacity: 0.7">
<img src="http://parteetime.com/pics/wallpaper/majestic-1280-1024.jpg"/>
</div>
Any help would be great.
Upvotes: 1
Views: 62
Reputation: 15699
opacity
makes whole element opaque.
Use rgba as background-color to prevent whole element from being opaque.
This will only make translucent background.
Try:
div{background-color:rgba(0,0,0,0.7);} //rgba -- red,green,blue,alpha
See fiddle for the difference,
Upvotes: 5