Hi again guys! As you can see I’m not dead :p
I know it’s been forever. I’m really sorry. I write this blog to help out everyone that is interested in CSS. I don’t earn money with it, so unfortunately I can’t spend all the time I want writing. I’ll try to improve my timing though
Well, no more introductions. Let’s get down to business.
We all hate IE6
This browser is crap and we all know it. Unfortunately, some clients demand support for this browser so we can’t avoid having some workarounds for it.
PNG Images
.png images have the best quality and fidelity for our web designs. Their best feature is their seamless and smooth transparency. We can achieve transparency with .gif files but their smoothness are not even close to .png files.
There are many times where our designs need a transparent .png and we also need to add support for IE6. So… what do we do?
PNG fixes to the rescue!
PNG fixes are mostly javascript (sometimes css) solutions for fixing IE6’s lack of transparency support for.png files. There are various PNG fixes. Here are some of them:
- Unit PNG Fix (JS)
- DD_belatedPNG (JS)
- Komodo Media’s PNG Fix (CSS)
The good thing about PNG fixes
- They are easy and fast to setup.
- They get rid of the problem in most cases.
Problems using PNG fixes
Well, unfortunately, it’s not everything as nice as cupcakes and rainbows. I’ve encountered some problems using PNG fixes:
- Background-image support is quite poor (repeats and positions specially).
- It’s a pain in the ass if you are using CSS sprites.
- Sometimes the proportion of the images gets screwed up.
- You add another javascript file to your page.
- In CSS workarounds the code isn’t pretty and fails W3C’s validation.
Ok… so what now?
Well, I have my own workaround for transparent .png’s in IE6. Maybe you will like it, maybe not, but I wanted to share the technique in case it comes in handy for you.
I don’t use transparent PNG’s for IE6
That’s right. I use .gif files instead.
Sorry to dissapoint, but I believe this is the way to go.
The quality of our images decreases of course, but we are embracing and accepting the browser’s limitations.
Using the technique:
HTML code
<div id="myDiv1" class="section"></div> <div id="myDiv2" class="section"></div> <div id="myDiv3" class="section"></div>
CSS code
.section {background:url(briefcase.png) repeat 0 0;}
#myDiv1 {background-color:#333;}
#myDiv2 {background-color:#666;}
#myDiv3 {background-color:#999;}
Ok, so this will give us a bunch of coloured divs with a briefcase on their background. This will work for every browser except IE6 (that instead of being transparent, it will have a light-blue background below the gradient image).
Fixing it for IE6:
We will use the star or holy hack to refer only to IE6.
* html .section {background-image:url(briefcase.gif);}
That’s it! We force IE6 to load a .gif file instead of loading the .png file.
Take a look at the final example
Benefits
- Simple, easy and short.
- Respects the background properties defined for all browsers (repeat + position).
- Compatible with CSS sprites (you just save the file in another format).
- Doesn’t mess up image proportions.
- W3C valid.
- You don’t add another file to your <head>.
Drawbacks
- The quality of the transparent image decreases (in some case more evident than others)
- You have an extra image file in IE6.
Conclusion
IE6 can’t handle transparent .png files. It’s a deficiency of the browser. This technique gives the browser a file type that it can handle and not another thing that it’s not really meant for it.
This is not “THE ULTIMATE SOLUTION” but gives you another possibility to solve these type of problems.
Your experience will help you decide in which case you should use option A or B.
I hope it helps you. Cheers!

Hello Ignacio, good to see you back with a nice post and example!
Just FYI, the DD_belatedPNG fix you link to, actually solves most of the problems you mention, including background position and repeat. Issues #2, #3 and #5 are therefore non-issues, and issue #4 can be solved by server-side JS packing.
Another advantage of the DD fix is that you create the site for PNG-supporting browsers, and then catering IE6 takes only 5 minutes to add the script. Very useful if you’re on a tight timeline. No need to spend a lot of time cranking GIF’s, adding extra css rules, and testing IE6.
The main drawback, of course, is that it requires JS. If you think that ~20% users are on IE6, and ~5% of those have JS turned off, that’s a small number I’d be willing to tolerate.
Well, you said it… we all hate IE6.
I thought of the solution you offered before… but some clients like and other hates it. We’re forced to use the JS fixes otherwise it will be a drawback in our work.
I hate IE6 and I’m pretty sure most if not all web developers do. It is FRUSTRATING dealing with IE6 problems every single day and it takes up most of my time. Instead of moving on to another project, I have to fix issues caused by this. The tips you gave are very useful. Thanks for posting this.
“Хорошо пишешь”
Hey, nice to see you writing again! Just a note that you can also save PNG images with 8-bit compression to get basic transparency in IE6, just like with GIFs.
Instead of catering to the slow and un-adaptive group of people still using IE6, maybe we should all just stop supporting it all together. Do you still support other obsolete browsers such as Netscape? Probably not — at least I pray to god you don’t. IE has upgraded two whole versions since version 6. People who cater to the Firefox crowd don’t painstakingly make sure their code is compatible with Firefox 1.
I am aware that the enterprise world has bought into IE6 for some odd reason. But when you go to buy the latest Hollywood film, you don’t reach for the VHS version (ok, kind of a weird analogy). I have cut all support for IE6, and now educate my clients that the way forward is only stifled by always going back to make sure something is okay or at least working.
Levi, unfortunately not all my clients belong to Europe or the United States, and their customers use poor technology.
Sometimes I’m forced to keep supporting IE6. It’s not a question of choice, is a question of what my client needs or demands.
Levi, I’d have to agree with your comments. It’s not a good thing that you have to cut support for a small group of people, but we live in a time when many people have broadband or at least access to an internet connection. It’s reasonable to think that someone could be using the latest browsing technology, for free, in 5 – 45 minutes depending on their connection. Considering return on investment, it’s simple.
Thank you Ignacio!
I was going to update my site with sprites and your sprite tutorial came in very handy.
I have a question about the ie6 .png fix:
When you have a lot of images, wouldn’t it be easier to refer to a “ie.css” document via
and declare all the images as gif’s?
Thanks again for your tutorials!
)
Greetings
Ignazio (with z)
Of course you can do that Ignazio ;D
But if you only need to change 1 single image, I personally wouldn’t add another stylesheet.
If you have several image, load another stylesheet of course.
Cheers!
This article gives one of the only feasible solutions to supporting IE6. I had a problem with transparent pngs in IE6, and I figured it was just easier to merge the two images I was using into one jpg, since I didn’t really need to utilize the transparent png. How about an article on dealing with css opacity and IE. It seems no versions, include IE8, support this declaration.
Nice post, but everytime I save a transparent image with .gif extension the borders look jagged, so if you can create a post about how to set the image settings in photoshop when saving a transparent gif image for web would be awesome!!
Thanks
I do my best to keep IE6 in mind, so I do refrain from transparent PNGs. The way I compensate for a simple transparent image is to have the image background be equal to the page background. I realize that there are many constraints to that approach, but it helps me prevent myself from “over designing” a page.
Hey Ignacio,
Thanks for a great post.
I wanted to suggest that you use a separate stylesheet for IE6 instead of using the star hack. I think keeping all your IE6 styles on a separate sheet is a bit more elegant and easier to manage.
Cheers
I use another stylesheet if I have to make several fixes.
For just one line, I prefer not to
I’m happy to work on issue of IE 6 as it pays me!!
Thanks for a great post.
Hey I was having this problem, now after following this its resolved now. Thanks for sharing.
Great post, good to see everybody else hates I.E.6. Does anybody know of a good web resource for browser trends and use.
You sir,
Are my hero.
Thank you!
True talked about a comprehensive, thank you share. Browser compatibility is really troublesome.
http://www.sitepoint.com/blogs/2007/09/18/png8-the-clear-winner/
As this site claims and is true I have tested for myself and linked this site so that you may see the differences for yourselves. The problem with ie6 is that it doesn’t handle alpha-transparency but does handle index-transparency. well check the link I provided since I am feeling to lazy to explain it but main point is if you have fireworks if you don’t just piratebay it, when you save in png-8 format it will save as alpha and index transparency, so you can use only 1 image. See the link to understand better best of luck in all ur web building activities
Their best characteristic is their flawless and even simplicity. We can realize simplicity with .gif files but their silkiness are not smooth close to.
phentermine 37.5