IE6 Transparent PNG problem

Internet_Explorer_7_Logo_red

We all have faced this problem during HTML development. Internet Explorer 6 renders transparent PNG images in different way.  It puts some other color , it damages the design.

One solution is create gif images for IE6 and mention those in separate style sheet file for IE6

1
2
3
<span style="color: #ff6600;">&lt;!--[if IE 6]&gt;
&lt;link rel="stylesheet" href="css/style-ie6.css" type="text/css" media="screen" /&gt;
&lt;![endif]--&gt;</span>

A simpel solution is IE PNG FIX  javascript library.

You can download that library from : http://www.twinhelix.com/css/iepngfix/

You can see an online demo and usage here:

http://www.twinhelix.com/css/iepngfix/demo/

Remember to add that htc file inside your style sheet or like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
&lt;script&gt;
/** transparent png ie fix **/
<span style="color: #bf2e9d;">if</span> (document.all &amp;&amp; /MSIE (<span style="font: 11.0px Menlo; color: #2832cf;">5</span>\<span style="font: 11.0px Menlo; color: #2832cf;">.5</span>|<span style="font: 11.0px Menlo; color: #2832cf;">6</span>)/.test(navigator.userAgent) &amp;&amp; document.styleSheets &amp;&amp; document.styleSheets[<span style="font: 11.0px Menlo; color: #2832cf;">0</span>] &amp;&amp; document.styleSheets[<span style="font: 11.0px Menlo; color: #2832cf;">0</span>].addRule)
{
<span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span>document.styleSheets[</span>0<span style="font: 12.0px Menlo; color: #000000;">].addRule(</span>'.transparent'<span style="font: 12.0px Menlo; color: #000000;">, </span>'behavior: url(css/iepngfix.htc)'<span style="font: 12.0px Menlo; color: #000000;">);</span>
}
/****/
&lt;/script&gt;
1 Comments

One Response to “IE6 Transparent PNG problem”

  1. Randy July 10, 2010 at 5:01 pm #

    I can’t tell you how many times I wanted to use a transparent PNG. I could never get a GIF to look even close. I like the red IE logo too.

Leave a Reply

More in php (22 of 104 articles)


Here is a php function which returns from and to date as an array for a range: <?php function ...