Is it possible, in CSS or JavaScript, to leave a transparent image color?

2

For example, we have this boat:

<div>
    <img src="https://cdn2.vectorstock.com/i/thumb-large/94/56/lifeboat-vector-3669456.jpg" >
</div>

In this case, I want the transparent white color (#FFFFFF), but it could be any other.

How to do this, if at all possible ..?

    
asked by anonymous 26.06.2018 / 08:34

2 answers

-2

There is a CSS property that allows you to "hide" the background color of an image, but this image must be set to background .

The background of the div that has the image must be the same as the background color of the page, the color for which you want to replace the white. This is the example in JSBin .

background-image: url(lifeboat-vector-3669456.jpg);
background-color: grey; /* aqui será a cor de fundo da página */
background-blend-mode: multiply;

But is not supported on all browsers , and may not work correctly with all colors.

/ p>

I suggested that you use a server-side solution, using PHP or whatever language you're using.

    
26.06.2018 / 10:41
-5

Change the opacity of the image so it becomes more transparent You can use 0.01 to glhf

<div>
    <img style="opacity: 0.1;" src="https://cdn2.vectorstock.com/i/thumb-large/94/56/lifeboat-vector-3669456.jpg" >
</div>

Try This

    
26.06.2018 / 11:11