We Recommend

CSS: The Definitive Guide CSS: The Definitive Guide
Provides you with a comprehensive guide to CSS implementation, along with a thorough review of all aspects of CSS 2.1. Updated to cover Internet Explorer 7, Microsoft's vastly improved browser, this new edition includes content on positioning, text wrapping (nowrap), lists and generated content, table layout, user interface, paged media, and more.


Posted By

DeadLy on 01/18/08


Tagged


Versions (?)


Who likes this?

4 people have marked this snippet as a favorite

SpinZ
stoker
ginoplusio
joshontheweb


IE PNG FIX. CSS Solution


Published in: CSS 


  1. * html img,
  2. * html .png{
  3. azimuth: expression(
  4.   this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
  5. this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
  6. this.src = "/images/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
  7. this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')",
  8. this.runtimeStyle.backgroundImage = "none")),this.pngSet=true
  9.  
  10. );
  11. }

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: SmpleJohn on January 18, 2008

Um... look under the Most Popular links on the home page. There is already a solution for this. Is there a reason this one is better, or is it just a different way to do the same thing?

Just curious:)

Posted By: DeadLy on January 21, 2008

if you talk about it (http://snipplr.com/view/137/png-background-transparency-ie/), there hack only for one picture, but it is a decision for all of pictures of png

Posted By: mikaelhultkvist on February 13, 2008

Nice snipple! But I cant get it to work with background images. Anyone else got this problem. Its supposed to work om backgrounds to right?

Posted By: LadynRed on March 3, 2008

The transparency PNG 'fix' does NOT work for repeating images so unless it's a 1-image static background it won't work.

You need to login to post a comment.