更新时间:2022-06-10 01:14:40
IE8用 -ms-filter
替换了过滤器
。
如果您要支持所有版本的IE,您需要提供这两种样式。
If you want to support all versions of IE, you need to provide both of these styles.
-ms-filter
稍微不同于过滤器
:
现在,所有过滤器都指定了完整的 progid
字符串(根据您的示例,但某些过滤器可以使用较短的语法指定)。
All filters are now specified with their full progid
string (as per your example, but some filters could previously be specified with a shorter syntax).
-ms-filter
的值必须用引号括起来。这是为了防止它是无效的CSS语法(因为它包含冒号后 progid
它是无效的CSS;在坏的情况下已知会导致其他浏览器中的解析错误阻止他们正确地阅读CSS文件的其余部分)。
The value for -ms-filter
must be enclosed in quotes. This is to prevent it from being invalid CSS syntax (since it contains a colon after progid
it is invalid CSS; in bad cases has been known to cause parsing errors in other browsers that stop them from reading the rest of the CSS file properly).
因此,在您的示例中,您需要以下样式:
So in your example, you need the following styles:
.myelement {
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/thing.png', sizingMethod='scale');
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/thing.png', sizingMethod='scale')";
}
请注意,IE9已放弃对 filter
和 -ms-filter
,以支持等效标准CSS3属性。
Note that IE9 has dropped support for both filter
and -ms-filter
, in favour of the equivalient standard CSS3 properties.
这有助于。