PNG Support in IE6
Posted on Thursday, 12th April 2007 in Development, Technology by Simon
Internet Explorer 6 is notoriously rubbish at supporting PNG transparency resulting in images that appear with a grey background; not very useful. All is not lost. Angus Turnbull has created a work around for this issue. You can get all the information needed at this link http://www.twinhelix.com/css/iepngfix/, including support forums. This is possibly the easiest way to get full PNG transparency and importantly the technique works for CSS backgrounds, albeit when no used with the no-repeat attribute.
The secret behind this implementation is a filter introduced in IE55 that is called AlphaImageLoader. This filter takes an image with alpha channels and displays it. It has also a property for deciding how to scale the image.
To download this permanently: iepngfix.zip (15kb).
How to Implement
- Put the iepngfix.htc file into your CSS directory
- Put the blank.gif file into your CSS directory (otherwise you will need to edit the HTC file)
- Edit your CSS to include the following line behavior:url(iepngfix.htc); for the <img> tag
Known Issues
This uses CSS “behaviors”, a custom Microsoft extension to CSS. As such, it will not affect any other browsers like Mozilla and Opera which already implement good PNG support. It will also not help IE4.0 and IE5.0, which don’t include the necessary IE filter, and does nothing with IE5/Mac (which natively supports translucent PNG foreground images, however).
You should not apply other visual filters to the iamge with the PNG behavior because these other filters do not respect the alpha channels and the result will most likely not be satisfactory.
Alternatives
An alternative source that I recently discovered is found at the following link http://webfx.eae.net/dhtml/pngbehavior/pngbehavior.html
Nice and easy fix, thanks. Remember to ensure images have appropriate width and height attributes set otherwise you’ll find png’s resized.