Web Development

Web Development Tips & Tricks, the things that you don’t want to figure out.





PNG Transparency in IE

I’ve run into a lot of trouble with this aspect in the past, namely onHover events with transparent buttons.

If you’re getting excited because you think you’re reading the solution – take it down a notch. Yes, I know how to do that, but that’s not what this blog is about. My solution to the above problem will lag the browser a little bit, not that noticeable, but definitely irritable.

This post is to handle the problem of simply displaying transparent PNGs in IE. Well, you have to use CSS and call a filter that allows transparency. That’s a simple fix.

The other day my friend, Rafferty Pendery, ran into this solution, which I thought was far better and wanted to show it to you. This page has the solution: PNG in Internet Explorer: How To Use. Basically, they are giving you a Javascript that automatically goes through all your pictures on the pages and checks if they’re PNG. If they are PNG, they give it the CSS filter.

All you need to do is include the Javascript file and all your PNGs will display their transparency.

Are you wondering why you shouldn’t use a GIF, which also supports transparency? A GIF doesn’t keep the same quality of color as a JPG or PNG unless its solid lines. If you’re creating some cartoon animation, great, use a GIF. If you are using a high quality picture you should use a JPG or PNG (JPG compresses better, but doesn’t support transparency.)

-Kerry

Share and Enjoy:
  • email
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Technorati
  • Google Bookmarks
  • Furl
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

  1. LarryJ posted the following on May 18, 2007 at 4:43 am.

    Good to know.


Leave a reply