Great script for image transparency in IE6

I’ve tried various clunky fixes for the IE6 PNG transparency problem, but yesterday ran across a wonderful little script from Angus Turnbull (from 2005, but no matter).

I tried it yesterday on a CSS background image and it works like a charm, but ran into some problems today trying to use it on a floated image.

Here’s the thing: when using it for a background image, follow the directions under ‘Transparent Backgrounds’ here and it works perfectly. But when you use it for a foreground image, you have to have a blank .gif file on the server, and you have to edit one line in Angus’ .htc file to point to that blank .gif.

This info is not obvious at all and I was really confused until I read Angus’ page thoroughly. But after loading the blank .gif and editing the iepngfix.htc file, all was well.

This is one of the easier implementations of a PNG fix I’ve seen. It uses the ‘behavior’ property in CSS, a Microsoft-proprietary thing and won’t affect browsers that already support PNG’s correctly.

Leave a Reply

Your email address will not be published. Required fields are marked *