gene b.
gene b.

Reputation: 11974

Replace Specified Color with Transparency in CSS

Is it possible to replace a specified color with transparency in CSS?

We have an image with white (255,255,255) parts. I am trying to use the rgba function to convert the white parts to transparency, but it's not working.

This image lies on top of another image, a blue background. The white shows through.

.logo {
background: url("../images/MasterLogo_resized.png") no-repeat scroll center 
    top rgba(255, 255, 255, 0);
}

.logo {
background: url("../images/MasterLogo_resized.png") no-repeat scroll center 
     top rgba(255, 255, 255, 0.5);
}

Upvotes: 0

Views: 919

Answers (1)

Larz
Larz

Reputation: 1186

You cannot change the properties of a PNG using css.

But, if your PNG is simple enough to be converted to an SVG (using a graphics program), you could use CSS to manipulate transparency and colors:
http://webdesign.tutsplus.com/articles/manipulating-svg-icons-with-simple-css--webdesign-15694

Upvotes: 3

Related Questions