IE Fixes: Embeded PNG Transparency


/ Published in: CSS
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.