如何重置或覆盖 IE CSS 过滤器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1768161/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I reset or override IE CSS filters?
提问by SpliFF
I'm using the proprietry MS 'filter' property to try and create a non ugly equivalent to css3 text-shadow and box-shadow;
我正在使用专有的 MS 'filter' 属性来尝试创建一个与 css3 text-shadow 和 box-shadow 等效的非难看的东西;
I was actually doing really well until I hit this problem. It looks like when I apply a filter to a div inside another div which also has a filter the filter effects end up being combined on the child object.
在遇到这个问题之前,我实际上做得很好。看起来当我将过滤器应用于另一个也有过滤器的 div 内的 div 时,过滤器效果最终会组合在子对象上。
I've tried using filter:none; to do a reset but no joy. I've also tried different variations on the syntax, ie "-ms-filter: 'progid:...Glow()'", "filter: progid:...Glow()", "filter: Glow()", etc..
我试过使用 filter:none; 做一个重置但没有快乐。我还尝试了不同的语法变体,即“-ms-filter: 'progid:...Glow()'”、“filter: progid:...Glow()”、“filter: Glow()” , 等等..
Testing in IE8
在 IE8 中测试
采纳答案by SpliFF
I've had some success by positioning the children absolute or relative. This didn't seem to work earlier though so it may break again once I get more complicated
通过将孩子定位为绝对或相对,我取得了一些成功。这似乎并没有更早地起作用,所以一旦我变得更复杂它可能会再次中断
I think once a parent has a filter applied all of it's children essentially become directx surfaces internally. You can still select text but it lags. I think text selection is a hack which makes each letter a seperate surface. It's a shitty mess which goes a long way to explaining why the browser in general and filters in particular are so buggy.
我认为一旦父级应用了过滤器,它的所有子级本质上都会在内部变成 Directx 表面。您仍然可以选择文本,但它会滞后。我认为文本选择是一种技巧,它使每个字母成为一个单独的表面。这是一团糟,这对解释为什么一般的浏览器和特别是过滤器如此有问题大有帮助。
回答by el22or
There is boolean attribute enabled, for which you can set falseor truehttp://msdn.microsoft.com/en-us/library/ms532997%28v=vs.85%29.aspx
启用了布尔属性,您可以为其设置false或true http://msdn.microsoft.com/en-us/library/ms532997%28v=vs.85%29.aspx
Example:
例子:
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(enabled=false)";
回答by Pink Duck
The -ms-filter property is a non-standard, browser-specific CSS entry and as such requires that its parameter is enclosed with quotation marks. So -ms-filter: "none" will work just fine.
-ms-filter 属性是一个非标准的、特定于浏览器的 CSS 条目,因此要求其参数用引号引起来。所以 -ms-filter: "none" 可以正常工作。
回答by browzah
try this:
尝试这个:
filter: -;
筛选: -;
回答by John C
If you're using HTML5 you may want to go down the route of using
如果您使用的是 HTML5,您可能希望沿着使用路线走
<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="ie6 oldie"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="ie7 oldie"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="ie8 oldie"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html lang="en" class="gtie9 modern">
<!--<![endif]-->
and in your CSS use something like:
并在您的 CSS 中使用类似的内容:
.ie9 .element {filter: none; }
回答by anddoutoi
Have you tried to enable/disablethe filter(s)?
您是否尝试过启用/禁用过滤器?
回答by max
I've found the best way is display:inline-block (applying white-space:nowrap to the container). But it seems to work bad with IE7 and lower
我发现最好的方法是 display:inline-block (将 white-space:nowrap 应用于容器)。但它似乎在 IE7 及更低版本上运行不佳