的background-with-css2-fallback
目的是为了救你脱离写background: #0E1B31;
线。你会使用这样的:
div {
@include background-with-css2-fallback(linear-gradient(top, #0E1B31, #0A1322), #0E1B31);
}
你将得到的是这样的:
div {
background: #0e1b31;
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #0e1b31), color-stop(100%, #0a1322)), #0e1b31;
background: -webkit-linear-gradient(top, #0e1b31, #0a1322), #0e1b31;
background: -moz-linear-gradient(top, #0e1b31, #0a1322), #0e1b31;
background: -o-linear-gradient(top, #0e1b31, #0a1322), #0e1b31;
background: -ms-linear-gradient(top, #0e1b31, #0a1322), #0e1b31;
background: linear-gradient(top, #0e1b31, #0a1322), #0e1b31;
}
我觉得你真的只是想:
div {
background: #0E1B31;
@include background(linear-gradient(top, #0E1B31, #0A1322));
}
它将工作一样,是更可读,输出更少的代码。如果您希望颜色在较新的浏览器中保持渐变,您可以将包含更改为background-image
。
'background-with-css2-fallback'实际上不会输出您显示的内容。以下是我输出的内容:https://gist.github.com/1835299我运行Compass版本0.12.rc.0。 – Shpigford 2012-02-15 12:10:23
在这段代码中,'data:image/svg + xml'这一行是丢弃旧版IE的。 – Shpigford 2012-02-15 12:11:26
您必须打开一个关闭的设置。我猜你有这个地方:'$ experimental-support-for-svg:true'。我不知道svg支持如何工作。抱歉。 – 2012-02-17 01:43:17