How do I reset or override IE CSS filters?

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 reset 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


Solution 1:

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)";

Solution 2:

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.

Solution 3:

try this:

filter: -;

Solution 4:

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.

Solution 5:

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; }