CSS有一个名为filter的命令,它有许多功能示例:
filter: grayscale(0);
filter: sepia(0);
filter: saturate(1);
filter: hue-rotate(0deg);
filter: invert(0);
filter: opacity(1);
filter: brightness(1);
filter: contrast(1);
filter: blur(0px);
支持Chrome 18+,Safari 6+的滤镜。(来源:http://css3.bradshawenterprises.com/filters/)
我需要使用grayscale, sepia, saturate, brightness, contrast, blur。但由于一些浏览器(ie、mozilla、opera)不支持filter,我无法使用任何一个功能。
我的问题:也许这些功能有替代品或其他方式可以获得类似的结果,如:grayscale, sepia, saturate, brightness, contrast, blur?
我尝试过添加前缀:-moz-, -o-, -ms-
从微软官方网站的示例中找到了一些东西,但是并没有起作用 :/(来源:http://msdn.microsoft.com/en-us/library/ms532847(v=vs.85).aspx),像这样:
filter:progid:DXImageTransform.Microsoft.MotionBlur(strength=50)
progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1); width=50%
有趣的是,我找到了针对Internet Explorer 6、7、8的解决方案(来源:http://www.smashingmagazine.com/2010/04/28/css3-solutions-for-internet-explorer/),我尝试在我的Internet Explorer 11上测试它,但它没有起作用。代码:
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#81a8cb', endColorstr='#4477a1'); /* IE6 & IE7 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#81a8cb', endColorstr='#4477a1')"; /* IE8 */
我需要找到一个能够在Mozilla、Opera和Internet Explorer上运行的解决方案,至少需要支持最新版本。
-ms-filter
仍然是IE专有的,但我相信他们迫不及待地想要放弃它,转而使用SVG滤镜。 - BoltClock