Created
May 24, 2013 17:04
-
-
Save trumball/5644954 to your computer and use it in GitHub Desktop.
Transparent PNG Fix For IE6
Using transparent images inside websites has become a very common practice. This started with gif images, but has evolved into alpha-transparent PNGs. Unfortunately older legacy versions of Internet Explorer have never supported the transparency. Adding this brief CSS snippet should clear up the problem.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.bg { | |
width:200px; | |
height:100px; | |
background: url(/folder/yourimage.png) no-repeat; | |
_background:none; | |
_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/folder/yourimage.png',sizingMethod='crop'); | |
} | |
/* 1px gif method */ | |
img, .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)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment