View Full Version : Transparent images

07-31-2009, 03:28 AM
What's the general stance to images with transparent backgrounds? Are they recommended if required? Will they work properly?

07-31-2009, 08:52 AM
It depends on what quality you want. Some gifs can have transparent backgrounds and still be decent quality. Some can't. In which case you would likely want to use the png format. While most modern browsers IE7+, Firefox, Safari, Chrome, and Opera all support the alphatransparency on png images just fine however IE6 doesn't. You will need to use some js to get them to work properly. The JS will load Microsoft's alphatransparency filter allowing the images to look okay. Another issue you may run into when using png images is the color will vary between Internet Explorer and other browsers. IE will show the color on the png images darker. This can be a problem if you are trying to match a CSS color with the color on the png. There is a reason for this and it can be fixed quite easily with TweakPNG (http://entropymine.com/jason/tweakpng/). Just remove the gAMA chunk from the png and resave it. It will now look fine in all browsers. Safari 1.3.x can't display png images properly but there is nothing you can do to fix that. Besides Safari is on version 4 already. Read this article for more on fixing the png color issue in Internet Explorer.