About Contact EOS

IE PNG - The PNG Transparency Problem in Windows Internet Explorer

,
1 Star2 Stars3 Stars4 Stars5 Stars
2
  • Digg
  • Technorati
  • del.icio.us
  • Propeller
  • StumbleUpon
  • Reddit
  • Mixx
  • Fark
  • Slashdot
  • Sphinn
  • Design Float
  • description
  • BlinkList
  • E-mail this story to a friend!
Enter your email address:

Never Spam

As many web developers may already know, several versions of Windows Internet Explorer (IE), cannot properly render PNG image transparencies. There are many CSS hacks and tricks out there to skirt this issue, most often by using less sexy graphics specific for IE browsers.

There is also a lesser known way of fixing the IE problem using a few simple lines of JavaScript.

The only downside to the JavaScript solution is that it only works on <img> elements, and does not work on background images or images placed with a style sheet. Also, the images must have their height and width attributes defined in the HTML.

The following JavaScript code is made available by ntlworld.com:

To use this code, simply call the script to the file in need of the fix and be certain your PNG images have the height and width attributes defined.

That’s it!

It appears you are new around here. You may want to subscribe to my RSS feed or register for email updates. Thanks for visiting!

Related Posts


Using DIV and SPAN Elements as Clickable Links

Center Absolute Position DIV

HTML Code Bloat - How to eliminate HTML code bloat from your web pages

Social Bookmarks Bar

Desktop Wallpaper


Related Sites

2 Comments

  1. Chris

    August 28, 2006 @ 2:48 pm

    This is a fix I’ve used for Transparent Background images:

    if (navigator.platform == "Win32" && navigator.appName ==
            "Microsoft Internet Explorer" && window.attachEvent) {
    	window.attachEvent("onload", alphaBackgrounds);
    }
    
    function alphaBackgrounds(){
    	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
    	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
    	for (i=0; i

    [Reply]

  2. PNG image format..what is it good for? « interface design for the web

    September 26, 2006 @ 7:45 am

    [...] An overview of PNG status in different web browsers: Browsers with PNG Support The PNG problem in Windows Internet Explorer IE PNG - The PNG Transparency Problem in Windows Internet Explorer [...]

RSS feed Comments | TrackBack URI

Write Comment

© Copyright 2003-2008 Zach Graeve and Expert Online Services, LLC
"Embrace Your Vice" (TM) is a Registered Trademark. All Rights Reserved.

125x125 Hosting & Servers at GoDaddy.com Fresh Books