I'm trying to add a transparent red overlay to an image whenever the image has a tinted-image
class, I want to do it with CSS. Actually, I want to apply it directly img
tag. Is this possible?
I tried this:
<img class="tinted-image" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/owl1.jpg"></img>
And CSS:
.tinted-image {
background:
/* top, transparent red */
linear-gradient(
rgba(0, 255, 0, 0.45),
rgba(0, 255, 0, 0.45)
)
}
And nothing happens.
I don't want to use a div, like below. The thing is that I want to implement it directly in the img tag.
<div class="tinted-div"></div>
.tinted-div {
width:200px;
height:200px;
background:
/* top, transparent red */
linear-gradient(
rgba(0, 255, 0, 0.45),
rgba(0, 255, 0, 0.45)
),
/* bottom, image */
url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/owl1.jpg);
}
Please somebody help me? :(