当我在ColorZilla上制作线性渐变时,我采用如下所示的 scss 代码:
@include background-image(linear-gradient(top, #659adc 0%,#004ca2 100%));
生成这个css:
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #659adc), color-stop(100%, #004ca2));
background-image: -webkit-linear-gradient(top, #659adc 0%, #004ca2 100%);
background-image: -o-linear-gradient(top, #659adc 0%, #004ca2 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(top), color-stop(0%, #659adc), to(#004ca2));
background-image: linear-gradient(top, #659adc 0%, #004ca2 100%);
这些都不适用于 Firefox。所以我做了一个调整,我添加了一些我知道在 Firefox 中有效的东西:
@include background-image(linear-gradient(to bottom, #659adc 0%,#004ca2 100%)); //notice the 'to bottom'
现在这是生成的 css:
background-image: -webkit-gradient(linear, to bottom, to top, color-stop(0%, #659adc), color-stop(100%, #004ca2));
background-image: -webkit-linear-gradient(to bottom, #659adc 0%, #004ca2 100%);
background-image: -o-linear-gradient(to bottom, #659adc 0%, #004ca2 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#659adc), to(#004ca2));
background-image: -webkit-linear-gradient(top, #659adc 0%, #004ca2 100%);
background-image: -o-linear-gradient(top, #659adc 0%, #004ca2 100%);
background-image: linear-gradient(to bottom, #659adc 0%, #004ca2 100%);
在 Firefox 中渲染良好,但 compass 任务因以下错误而哭泣:
无法确定的相反位置:到
想法?你如何做一个跨浏览器的scss线性渐变?