且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

-ms-filter 与 filter 有什么区别?

更新时间:2023-12-04 11:26:52

Microsoft 引入了 -ms-filter 以使 Internet Explorer 更加符合标准(CSS 2.1 要求供应商扩展具有供应商前缀).由于原始 filter 属性的语法不符合 CSS 2.1,IE8+ 要求将 -ms-filter 属性的值括在引号中.

filter: alpha(opacity=40);-ms-filter: "alpha(opacity=40)";

IE8+ 支持

-ms-filter,据我所知,旧的 filter 属性是为了向后兼容所有版本的 Internet Explorer.>

相关链接:http://blogs.msdn.com/b/ie/archive/2008/09/08/microsoft-css-vendor-extensions.aspx

请注意,IE10 中可能会移除对过滤器的支持.

What's the difference between between IE's filter and -ms-filter properties? If I use one should I use them both? Do they do the same thing, but each work on only certain versions of IE?

Microsoft introduced -ms-filter to make Internet Explorer more standards-compliant (CSS 2.1 requires vendor extensions to have vendor prefix). As the syntax of original filter property is not CSS 2.1 compliant, IE8+ requires the value of the -ms-filter property to be enclosed in quotation marks.

filter: alpha(opacity=40);
-ms-filter: "alpha(opacity=40)";

-ms-filter is supported in IE8+, legacy filter property is, as far as I know, for backwards compatibility supported in all versions of Internet Explorer.

Related link: http://blogs.msdn.com/b/ie/archive/2008/09/08/microsoft-css-vendor-extensions.aspx

Please note that support for filters may be removed in IE10.