image tag png fix for ie6


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

requires blank.gif (transparent 1px gif image)


Copy this code and paste it in your HTML
  1. * html img, /*png fix for <img> */
  2. * html .png{
  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 = "/style/blank.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)
  8. );
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.