IE5.5和IE 6不支持PNG alpha透明度。 当我们放置一个PNG透明背景图像,并使用IE5.5或6打开时,该图像将显示为难看的灰色,如下所示
支持IE5.5 / 6 PNG alpha透明性的常用方法有两种。
1)Microsoft.AlphaImageLoader
2)Twinhelix – iepngfix.htc
PS IE7和其他浏览器(例如Opera和firefox)在使用PNG alpha透明性支持方面没有任何问题。
Microsoft.AlphaImageLoader
使用“ filter:progid:DXImageTransform.Microsoft.AlphaImageLoader ”方法加载PNG图像。
Twinhelix – iepngfix.htc
访问http://www.twinhelix.com/css/iepngfix/并下载iepngfix.zip文件。 解压缩并获取iepngfix.htc和blank.gif文件。
PS Both解决方案将在我们在本地打开Active X安全对话框时提示。 请单击允许被阻止的内容以查看效果。 但是,如果网页托管在Web服务器中,则不会提示Active X安全警告。
在此处下载源代码–> PNG alpha透明度测试
参考
1)Microsoft.AlphaImageLoader – http://msdn.microsoft.com/zh-cn/library/ms532969.aspx
2)Twinhelix – iepngfix.htc – http://www.twinhelix.com/css/iepngfix/
翻译自: https://mkyong.com/javascript/how-do-make-ie55-6-support-png-alpha-transparency/