Announcing:

LessMoney Conference will be June 7th in Tampa! Register today and make us smile super big!

I've found the holy grail...

written by Allan on March 06, 2008

IE6 PNG Transparency Fix for Repeating Background Images

This hack is for making transparent pngs, actually transparent in IE6 when used as a repeating background. I'm sure most people have a hack they use for transparent png images in the html for IE6. This isn't another fix for that, again, this is for background images that repeat.

First, put a conditional statement in your head to display this hack when IE6 is used. Inside of this conditional statement you will insert the hack.

filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/transparent_bg.png', sizingMethod='scale');

Now, I haven't experimented much with this. I haven't tried X and Y repeating, if you do try this, post the results as a comment on this blog post. However it does work great with standard repeating of a background image.

In your normal css sheet it's business as normal, just place the background in the css and have a nice day. Below is an example of the conditional statement and the css hack.

<!--[if IE 6]>
<style>
#IE_blows {
height: 100%;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/transparent_bg.png', sizingMethod='scale');}
</style>
<![endif]-->

/* put in normal css sheet */
#IE_blows {
  background: url(/images/transparent_bg.png) repeat-y;
}
/* put in normal css sheet */

 

Learn how LessEverything built their consultancy to over $1,000,000 annual revenue at LessMoney Conference, June 7th in Tampa Florida. Each attendee will get early access to our upcoming ebook as well.

Leave a Comment

About Allan
Allan loves his family more than breathing. He lives in Panama City, Florida & grew up washing cars at his family's car washes. Oh and Allan hasn't worn underwear since 2004.

You Should...

Follow Allan on Twitter
Friend Allan on Facebook
Subscribe
LessEverything Copyright 2011 LessEverything.com
We don't like footers, they're kinda boring