Home » Web Design » PNG Transparency Issues

PNG Transparency Issues

If you are CSS coder, you’ve probably ran in to png transparency problems many times. Even Microsoft is having problems with it http://runonce.msn.com/runonce2.aspx open in IE6. So I’ll tell you few problems and solutions I’ve handled so far.

First one is if you need just simple transparent image, without some special needs for example backgrounds etc. The solution would be png fix. I’ve used it many times but it has lots of faults, for example with padding, margins and absolute positioning. Sometimes i can mess up the rest of your JavaScript files, but anyway very useful script. You can include it in your <head> tag

png image example

<!--[if lt IE 7.]>
<script defer type="text/javascript" src="pngfix.js"></script>

The second one can partly handle issues from first and it’s pure CSS solution. I mostly use this for backgrounds, because if your path for a background is from CSS file then png fix can’t handle it.

png example

.someelement {
background-image: url(images/image.png);
* html .someelemen {
background-color: #333;
back\ground-color: transparent;
background-image: url(images/blank.gif);
filter: progid:DXImageTransform.Microsoft.
AlphaImageLoader(src="images/image.png", sizingMethod="scale");

I found this very useful, and also when you add some hover effects for example some color or other image.

NOTE: This simple hover is just example and it doesn’t work in IE6

.someelement:hover {
background: #333;
.someelement:hover {
background-image: url(images/image2.gif);

Only problem I had with this was with <a> tag, link just don’t work (when it’s in div with this kind of background) and i don’t know why (talking again for IE6). And only solution i could think of was to place another absolute div over it for the links, content etc… Yes i know it’s not elegant but it works if content is not dynamic.

Luckily more and more people are starting to use IE7, and i must say i have recently switched too, i had to have IE6 because of testing my code and when i found out for Multiple IE program I switched immediately

About Master Project Genesis

Leave a Reply

Your email address will not be published. Required fields are marked *