Monday, January 11, 2010

Ie6 PNG transparency Fix / Hack

As IE6 doesn't support Alpha Channel Transparency PNG files. With this code we can use PNG’s In IE 6.
Just Copy and paste this code in this CSS file. Copy transparent.gif in to "images" folder.

/*Start css code*/

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

/*End css code*/

Image : transparent.gif


Brilliant way to implement.As companies grow and change, innovative and results oriented solutions, not just on the internet, but company-wide solutions, are being sought.

Post a Comment