Any web developer knows that Internet Explorer 6 can’t load PNG files with transparency (24 bits). We have to use filter “AlphaImageLoader” to fix it, that is very hard and you will use more resources applying this solution.
Drew Diller public researched post “Medicine for your IE6/PNG headache” and javascript
The problem is inside VML technology with shape and fill objects (what Drew Diller have used).
So I’ve written a special CSS library for CSS sprites use.
What do we need?
- Declare VML namespace for Internet Explorer
- DOM ready CSS event
- My CSS library
Let’s do it!
1. Declare VML namespace for Internet Explorer
Using Conditional Comments in head part of our HTML:
1 2 3 | <!--[if IE]> <xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v" /> <![endif]--> |
2. DOM ready CSS event
global.domready.ie.css — this is jQuery light DOM ready event written by expression.
Connect it to our document for all of IE:
1 2 3 4 | <!--[if IE]> <xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v" /> <link href="global.domready.ie.css" media="screen" rel="stylesheet" type="text/css" /> <![endif]--> |
3. My CSS library
Connect it to our document, final result:
1 2 3 4 5 6 7 8 | <!--[if IE]> <xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v" /> <link href="global.domready.ie.css" media="screen" rel="stylesheet" type="text/css" /> <![endif]--> <!--[if IE 6]> <link href="g-png.ie6.css" media="screen" rel="stylesheet" type="text/css" /> <![endif]--> |
How to use it?
Simply connect all files and add class name
<span class="shadow g-png"></span>In action:
Known issues
Background-repeat (use DD_belatedPNG for it).- Center positioning.
- Opacity.
This is a complete solution, it means that you don’t need to use javascript manipulations.
And it’s specially thought for CSS sprites or simple png public.
Warning: Safari doesn’t like these files and ignores them.
Summary
This is a very light solution and has been tested and used in a big production web, but it may has bugs in different situations.
Feel free to mail me anytime if you have any problem or question.
Martin Funcich, 3.09 at 4:10 pm
If you can figure out a way to code your IE6 expressions without { } brackets, Safari will accept your CSS file once again.
It rejects the CSS when it sees nested { { } } brackets, which “shouldn’t happen in a real CSS file” so it seems