English 中文(简体)
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

最佳回答

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.

问题回答

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

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





相关问题
Image rendered with wrong colors in IE8

I have a gradient image as a PNG (no transparency) in a web-page. By taking a screenshot of Chrome showing the page and cropping the image from the page, I see the exact same colors are drawn as the ...

Determine Mobile Internet Explorer version

I need to determine the version of Mobile Internet Explorer on a Windows Mobile 6.1 device. So that I can report the same user-agent string as is being used by Mobile Internet Explorer. The user-...

CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

Internet Explorer only part loading JavaScript/CSS

I m having trouble with my local development environment where IE (6 through to 8) is only part loading JavaScript/CSS files. It throws random errors at random places in jquery.min.js every time I ...

IE doesn t run Javascript when you click back button

I ve built a shop with tons of JS running. One of the pieces of the cart, is a zip code field which is required to calculate shipping cost. This works fine going through the cart. Now clicking ...

热门标签