ucnobi ucnobi
ucnobi ucnobi

Reputation: 255

Fill transparent image with background color

I've a transparent image and want to fill with some color as a background. Here are images : enter image description here

And After fill with red color: enter image description here I want to make only car's background red, not square. This is my css :

 #loader-img{
 background:red;
}

This is whole html :

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Loader</title>
    <style>
        #loader-back{
            position:absolute;
            width:100%;
            height:100%;
            background : url('../content/img/loader-background.png');
            top: 0;
            left: 0;
        }
        #loader-img{
            position: absolute;
            top: 50%;  
            left: 50%;
            transform: translate(-50%, -50%);
            -webkit-transform:translate(-50%, -50%);
            background:red;
        }
    </style>
</head>

<body>
    <div id="loader-back">
        <img src="~/content/img/loader.png" id="loader-img" />

    </div>
   </body>
</html>

Upvotes: 0

Views: 3851

Answers (1)

K-tanie
K-tanie

Reputation: 9

having read at your question here is the code for you, to change the background colour you can change the colour gold to any colour you want

<img src="https://www.pinclipart.com/picdir/big/18-187351_laser-clipart.png" style="background-color:gold;">

Upvotes: 0

Related Questions