-ms-filter 和 filter 都用于 IE 中的渐变吗?
我正在使用以下代码,但现在我不知道是否需要同时使用这两个:
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#46494F', endColorstr='#141A1E',GradientType=0);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#46494F', endColorstr='#141A1E',GradientType=0)";}
让我更困惑的是 VS2010 报告以下消息“验证 CSS 2.1 - 过滤器不是已知的属性名称”。
有没有人在使用这些时遇到过类似的问题? IE9及以上版本怎么样?这些是否仍在使用,或者浏览器正在使用新的 CSS 标准?
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."
Has anyone experienced similar issues using these? How about with IE9 and above? Are these still used or is that browser using new CSS standards?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
filter
和-ms-filter
是 Microsoft 发明的专有 CSS 属性,仅用于 IE,因此验证消息不是问题。filter
用于 8 之前版本的 IE,而 IE8+ 采用前缀版本-ms-filter
。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
is used for IE older than 8, while IE8+ adopts the prefixed version,-ms-filter
.微软在 IE8 中用
-ms-filter
替换filter
的原因是他们需要对其进行不兼容的语法更改。-ms-filter
允许您将整个过滤器字符串括在引号中,而旧的filter
样式则不然。这很重要,因为许多过滤器都包含诸如
progid:
之类的字符串(由于冒号,这是无效的 CSS)。在filter
样式中包含这些过滤器(不带引号)可能会导致其他浏览器在整个样式表上阻塞。IE9 完全放弃了对
filter
和-ms-filter
的支持。如果你想在 IE9 中使用这些效果,你必须使用标准 CSS3。The reason Microsoft replaced
filter
with-ms-filter
in IE8 was because they needed to make incompatible syntax changes to it.-ms-filter
allows you to wrap the whole filter string in quotes, whereas the olderfilter
style doesn't.This is important because many filters include strings such as
progid:
(which is invalid CSS due to the colon). Including these filters in afilter
style, without the quotes can cause other browsers to choke on the entire stylesheet.IE9 has dropped support for both
filter
and-ms-filter
entirely. If you want to use these effects in IE9 you have to use standard CSS3.