Unit PNG Fix Enables Transparent PNG Support in IE6

I just stumbled upon Unit PNG Fix by Unit Interactive. It is one among the many JavaScript based PNG transparency solution for IE6, and is inspired by the SuperSleight solution. What’s good about it though is that it is fully DOM based and automatic. There is no need to assign any additional classes (such is the case with TwinHelix IE PNG Fix) or rename any files (refer to Dean Edwards IE7 fix).

The official website lists the following features:

  • Very compact javascript: Under 1kb!
  • Fixes some interactivity problems caused by IE’s filter attribute.
  • Works on img objects and background-image attributes.
  • Runs automatically. You don’t have to define classes or call functions.
  • Allows for auto width and auto height elements.
  • Super simple to deploy.

Impressed, I gave it a spin. I took one of my projects and replaced the existing TwinHelix PNG Fix code with Unit PNG Fix. It seems to work a charm in all areas except for one: elements with absolute positioning and / or z-index gets screwed up, as can be seen in the following screenshots:

Correct layout using TwinHelix PNG Fix:

This time using Unit PNG Fix:

Here’s the actual CSS code:

h1 a { background: url(images/logo.png) no-repeat; display: block; width: 256px; height: 128px; position: absolute; top: 15px; left: 472px; z-index: 99; }

Other than that, for “normal uses”, Unit is the easiest way to go. The project is only two weeks old, and I have high hopes that bugs like these will eventually be fixed to provide a truly plug and play IE7 PNG transparency solution.

On the same note, the PNG8 format may actually be preferable for low color, non-gradient alpha transparency requirements.

5 Responses to “Unit PNG Fix Enables Transparent PNG Support in IE6”

  1. Ben Carlson Says:

    Yeah, the Unit PNG fix seems pretty good, but the absolute positioning is buggy for me as well; haven’t been able to figure out how to get an image to position above everthing.

  2. Website Design Perth Says:

    I too came across this just the other day and it seemed very promising. Another bug I’ve found is that if you use a .png background image, IE6 ignores any repeat properties, instead you get no-repeat and the bg image is stretched to fit. Weird. The workaround is to change image format to .gif/.jpg.

    I’ll have a look at this absolute positioning problem and if I come up with anything I’ll report back here.

  3. Joe Says:

    It’s a frustrating thing to continually be limited by browsers that never got it right in the first place.

  4. Nathan Ford Says:

    First of all: Thanks for the bump on your site!

    We just posted a new version of the Unit PNG Fix on our site that we hope should fix the absolute positioning bug. Check it out and let us know if it works better for you:

    http://labs.unitinteractive.com/unitpngfix.php

    We are constantly trying to improve our tools, so please let us know if you have any comments or suggestions.

  5. Optimization css Says:

    In a container positioning should not be absolutely the wrong bar, I often use absolute positioning, are to do so!
    We recommend a CSS to optimize the compression tool: http://www.114css.com/www_114css_com/csszip/css_optimiser.php?lang=en

Leave a Reply