I have a regular image in the image tag like this:
<img src="http://i.imgur.com/StEW4JD.jpg" class="image">
that I want to turn into this image. I saw some examples of the blend mode but for the blend mode you need to set the image as background but I have the image in the image tag.
Can the hue be added to the image via css without setting image as background?
We can change the color of PNG image using following CSS styles: filter: none | blur() | brightness() | contrast() | drop-shadow() | grayscale() | hue-rotate() | invert() | opacity() | saturate() | sepia() | url() | initial | inherit; The above property is used to set the visual effect of the image.
Use the hue-rotate() function to apply a hue rotation on an image. The CSS hue-rotate() function is used with the filter property to apply a hue rotation an image. A hue rotation is where you specify an angle around the color circle that the input samples will be adjusted by.
If the product team was kind enough to also provide a white version of the image, you can simply toggle the image's src on hover. This can be done using JavaScript. You can use an onmouseover function that sets the image's src to white. png and then an onmouseleave function that sets the image's src to black.
Use a parent to your image with the desired background color.
Than set mix-blend-mode: overlay;
to your image
img{max-width:100%;vertical-align:top;}
.blend-overlay{ mix-blend-mode: overlay; }
<div style="background:#822;">
<img class="blend-overlay" src="https://i.imgur.com/StEW4JD.jpg">
</div>
https://stackoverflow.com/a/31528825/383904
you looking this type image. Demo link here https://jsfiddle.net/JentiDabhi/9v96yfro/
HTML
<div class="image-box">
<img src="http://i.imgur.com/StEW4JD.jpg" class="image">
</div>
CSS
.image-box {
position: relative;
display: inline-block;
}
div.image:after {
content: "";
background: rgba(255, 0, 0, 0.4);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With