简体   繁体   English

在IE中,-ms-filter和filter都用于渐变吗?

[英]Are both -ms-filter and filter used for gradients in IE?

I am using the following code but now I don't know if I need to use both of these: 我使用以下代码,但现在我不知道是否需要使用以下两个代码:

filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#46494F', endColorstr='#141A1E',GradientType=0);

-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#46494F', endColorstr='#141A1E',GradientType=0)";} 

What's making me more confused is that VS2010 reports the following message "Validation CSS 2.1 - filter is not a known property name." 令我更困惑的是,VS2010报告了以下消息“验证CSS 2.1 - 过滤器不是已知的属性名称”。

Has anyone experienced similar issues using these? 有没有人使用过这些问题? How about with IE9 and above? IE9及以上版本怎么样? Are these still used or is that browser using new CSS standards? 这些仍然使用或浏览器是否使用新的CSS标准?

Hope someone knows more than me about this. 希望有人比我更了解这一点。

Thanks, 谢谢,

filter and -ms-filter are proprietary CSS properties invented by Microsoft for use with IE only, so the validation messages aren't an issue. filter-ms-filter是Microsoft发明的专有CSS属性,仅用于IE,因此验证消息不是问题。

filter is used for IE older than 8, while IE8+ adopts the prefixed version, -ms-filter . filter用于8岁以上的IE,而IE8 +采用前缀版本-ms-filter

The reason Microsoft replaced filter with -ms-filter in IE8 was because they needed to make incompatible syntax changes to it. Microsoft在IE8中使用-ms-filter替换filter的原因是因为他们需要对其进行不兼容的语法更改。

-ms-filter allows you to wrap the whole filter string in quotes, whereas the older filter style doesn't. -ms-filter允许您将整个过滤器字符串包装在引号中,而旧的filter样式则不能。

This is important because many filters include strings such as progid: (which is invalid CSS due to the colon). 这很重要,因为许多过滤器都包含诸如progid:字符串progid:由于冒号而导致CSS无效)。 Including these filters in a filter style, without the quotes can cause other browsers to choke on the entire stylesheet. filter样式中包含这些过滤filter ,不带引号可能会导致其他浏览器在整个样式表上出现阻塞。

IE9 has dropped support for both filter and -ms-filter entirely. IE9完全放弃了对filter-ms-filter支持。 If you want to use these effects in IE9 you have to use standard CSS3. 如果要在IE9中使用这些效果,则必须使用标准CSS3。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM