Transparent images in Internet Explorer 6

2 March 2006, 10:50 CDT

Okay, well it was relatively easy to implement.

http://webfx.eae.net/dhtml/pngbehavior/pngbehavior.html

The problem is that Internet Explorer 6 and below do not support alpha transparency for PNG images. It only supports binary transparency for gifs, which means that if you want a semi-transparent image, or you’ve decided to use the higher-quality png format, transparency isn’t much of a real option for the IE viewers. They just see your image with a rectangular semi-transparent background of the browser’s choosing.

It might say and I just don’t see where, but this does not break support for Firefox or Opera, which I was concerned it might. A few notes, however:

– If you use this, you might have to redefine where blank.gif is located in the htc file (ie, /images/blank.gif).
– You will also have to specifiy the width and height of the image for IE, otherwise it will only show an empty space.
– This does not work for CSS background images, only on img tags.

Thanks to http://www.libpng.org/pub/png/pngstatus.html#browsers for leading to this solution – the most elegant one I’ve found so far.

Tags:

Leave a Reply