The rule below is read by IE 5 and 6, but the use of the escape character ("\") sandboxes the dynamic property for IE 6.
This CSS expression checks if the image is a PNG file, and if it is, it applies the filter and does the padding/height/overflow trick explained in my PNG overlay article.
Note that for this technique to work, you need to make sure that at least the width of the image is set, either via the markup or CSS.
* html img {
behavior: expres\sion(
(this.runtimeStyle.behavior="none") && (this.src.toLowerCase().indexOf('.png')>-1) && (
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='scale')",
this.runtimeStyle.paddingTop = this.height,
this.runtimeStyle.height = 0
)
);
overflow:hidden;
}
Transparency and png are hard to handle if your website need to function in older browsers like IE6. This CSS example will help.