开发者

How do I reset or override IE CSS filters?

开发者 https://www.devze.com 2022-12-12 04:46 出处:网络
I\'m using the proprietry MS \'filter\' property to try and create a non ugly equivalent to css3 text-shadow and box-shadow;

I'm using the proprietry MS 'filter' property to try and create a non ugly equivalent to css3 text-shadow and 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.

I've tried using filter:none; to do a rese开发者_如何学Pythont but no joy. I've also tried different variations on the syntax, ie "-ms-filter: 'progid:...Glow()'", "filter: progid:...Glow()", "filter: Glow()", etc..

Testing in IE8


There is boolean attribute enabled, for which you can set false or true http://msdn.microsoft.com/en-us/library/ms532997%28v=vs.85%29.aspx

Example:

-ms-filter: "progid:DXImageTransform.Microsoft.gradient(enabled=false)";


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.


try this:

filter: -;


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.


If you're using HTML5 you may want to go down the route of using

<!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:

.ie9 .element {filter: none; }


Have you tried to enable/disable the filter(s)?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号