简体   繁体   English

使用-ms的IE9渐变

[英]IE9 Gradient using -ms

Anyone know how I can make this work in IE9. 任何人都知道如何在IE9中实现这项功能。 The top one works great in firefox but when I add the second one for IE9 it doesn't work. 顶部的在Firefox中效果很好,但是当我为IE9添加第二个时,它不起作用。 Any ideas what I'm doing wrong. 任何想法我在做什么错。

    background: -moz-linear-gradient(top,  rgba(117,117,117,1) 0%, rgba(111,111,111,1) 5%, rgba(102,102,102,1) 11%, rgba(39,39,39,1) 42%, rgba(28,28,28,1) 50%, rgba(0,0,0,1) 53%, rgba(0,0,0,1) 100%); /* FF3.6+ */

    background: -ms-linear-gradient(top left, rgba(117,117,117,1) 0%, rgba(117,117,117,1) 5%,rgba(102,102,102,1) 11%, rgba(39,39,39,1) 42%, rgba(28,28,28,1) 50%, rgba(0,0,0,1) 53%, rgba(0,0,0,1) 100%);

I don't want to use PIE. 我不想使用PIE。

Try this out - Ultimate CSS Graident Generator 试试看-Ultimate CSS Graident Generator

Click the "IE9 Support" checkbox in the bottom right of the page. 单击页面右下方的“ IE9支持”复选框。

IE9 doesn't support gradients - only IE10: http://caniuse.com/#search=gradient IE9不支持渐变-仅IE10: http//caniuse.com/#search=gradient

Instead, I'd recommend using something like this to speed up coding in IE: http://www.bradshawenterprises.com/blog/2010/dynamically-drawing-gradients-with-php/ 相反,我建议使用类似这样的方法来加快IE中的编码: http//www.bradshawenterprises.com/blog/2010/dynamically-drawing-gradients-with-php/

I usually use this to generate a png of the gradient for me, then set that as the background first, then have another property after with the CSS grad. 我通常使用它为我生成渐变的png,然后先将其设置为背景,然后再使用CSS grad获得另一个属性。 This lets it work in all older browsers that don't support gradients, not just IE. 这样一来,它就可以在所有不支持渐变的较旧的浏览器中运行,而不仅仅是IE。

It also meant that when the spec changed, my sites still worked. 这也意味着,当规格更改时,我的网站仍然有效。

Alternatively, use http://css3pie.com/ , though I don't really like it for grads. 另外,也可以使用http://css3pie.com/ ,尽管我不太喜欢应届毕业生。

As stated in the other answers, the -ms prefix is for IE10+. 如其他答案所述, -ms前缀用于IE10 +。 IE9 drops support for the older filter syntax as well, so you can't actually render any gradients with pure CSS. IE9也放弃了对旧filter语法的支持,因此您实际上无法使用纯CSS渲染任何渐变。

One solution to this is use SVG gradients for the background-image property. 一种解决方案是对background-image属性使用SVG渐变。 http://css3wizardry.com/2010/10/29/css-gradients-for-ie9/ http://css3wizardry.com/2010/10/29/css-gradients-for-ie9/

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

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