Posted By

reynish on 07/28/10


Tagged

ie png transparency


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Badeye


IE Fixes: Embeded PNG Transparency


 / Published in: CSS
 

This will fix all embeded PNGs. this.src = "img/spacer.gif" Needs to point to a 1x1 transparent GIF or you'll get an Image not found icon in the corner of the PNGs.

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

Report this snippet  

You need to login to post a comment.