使用&“-ms-filter&"时如何保持PNG alpha透明度财产 [英] How to maintain PNG alpha transparency when using "-ms-filter" property
问题描述
我有以下HTML:
<a><img src="myfile.png" /> Some text</a>
这是CSS:
a:hover
{
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=75)";
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=75);
opacity: .75;
}
与此问题同时出现在IE 8和IE 7中.
The problem with this occurs in both IE 8 and IE 7.
当PNG图像受到 -ms-filter 或 filter 的约束时,其alpha透明度会被破坏.试试看,您会看到的.这是IE 8和IE 7中的一个错误.
When the PNG image is subject to the -ms-filter or filter, its alpha transparency is ruined. Try it out and you will see. It is a bug in both IE 8 and IE 7.
我可以删除CSS中应用的"-ms-opacity"和"filter"属性吗?这是什么语法?(例如 -ms-filter:"; )
Can I remove the "-ms-opacity" and "filter" properties applied in CSS? What is the syntax for this? (e.g. something like -ms-filter: "";)
有人知道解决此问题的方法吗?
Does anyone know a work around to this issue?
推荐答案
更新: AlphaImageLoader 滤镜可能会覆盖Alpha滤镜.至于删除过滤器,您尝试过 filter:none;
吗?
UPDATE: AlphaImageLoader filter applied directly to the img may override the Alpha filter. As for removing a filter have you tried filter:none;
?
是的,通过条件注释以编程方式针对IE6及以下版本.
Yes, programmically target IE6 and below with conditional comments.
<!--[if lt IE 7]>
<style>a:hover{filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=75);}</style>
<![endif]-->
IE7-js 之类的脚本也将为您处理PNG透明性而不会造成混乱用非标准代码来设置CSS.
Also scripts like IE7-js will handle PNG transparency for you without cluttering up your CSS with non-standard code.
<!--[if lt IE 7]>
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js" type="text/javascript"></script>
<![endif]-->
这篇关于使用&“-ms-filter&"时如何保持PNG alpha透明度财产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!