位置:轻松日志 » 帮助/文摘

IE之透明PNG解决方案

发表于:2005/02/02 00:21:20

IE之透明PNG解决方案

IE虽然没有直接支持透明的PNG图片,但是通过技巧我们同样能达到这一效果。(虽然已很少使用IE,但是考虑到Web技术对所有浏览器的兼容性,从这一点出发,我们还是应该为IE“着想”,毕竟使用IE的用户还占多数。

感谢Erik Arvidsson为我们提供的解决方案。

The secret behind this implementation is a filter introduced in IE55 that is called AlphaImageLoader. This filter takes an image with alpha channels and displays it. It has also a property for deciding how to scale the image.

<img src="blank.gif" style="width: 100px; height: 100px; filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='image.png', sizingMethod='scale')" />

See MSDN for a complete reference.

作者整理了一个htc, 拿来就可以用。具体如下:





文件下载和查看DEMO请看这里:PNG Behavior


收藏这篇文章

 

© 2007 Rocklv个人主页空间轻松日志v.1.1