Using the Transparent PNG as a Background Image
May 13, 2004
Like so many others out there, I wish I could use those transparent PNG images in all of my projects without having to worry about Internet Explorer users. So when I went to redesign my site I looked at my stats and found that a large percentage of the visitors used mozilla or safari, so I said, “I shall use the PNG.” As you know, when you do use a transparent PNG and someone with IE views your page, the results are not pretty. There is a way around it.
Replacing the PNG with the GIF
There are a couple transparent PNG images I use on my site, the main background and the selected tab background. However, what the IE user sees are GIFs instead, main background and tab background. The technique is really pretty simple.
#main {
background: url(../i/mainbg.png) repeat-y »
top left !important; /*Mozilla will apply this one*/
background: url(../i/a-mainbgie.gif) repeat-y top »
left; /*IE will apply this one*/
}
Yes, it does use a hack to trick IE inro ignoring the PNG, but I figure once IE fixes this bug (probably 2006) they will support transparent PNGs. It does require some extra work and I suggest it only be used when you really have the need for a transparent PNG.

A lovely site design! And nice to see it in the Vault Blake.
Posted on May. 18, 2004 12:09 #