LessCSS - IE gradient filter with variables and lighten

最后都变了- 提交于 2019-12-04 03:24:29

问题


I need to have an IE gradient filter in Less CSS with a variable and lighten. Is this possible?

#whatever {
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='lighten(@grayColor, 3%)', endColorstr='@greenColor', GradientType=0);
}

回答1:


As far as I know you can't mix escaping (because that's what you need here) and colour functions (lighen). So you'll need to store the startColor value in another variable.

@grayColor :#dddddd;
@greenColor : #ff0000;
@start : lighten(@grayColor, 3%);
.css {
   filter:~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{greenColor}', GradientType=0)";
}



回答2:


You can insert variables into string and "print them" in process of concatenation.Empty string need for get string as rezult of concatenation. All variables will be insert into string

@filterStr: "progid:DXImageTransform.Microsoft.gradient( startColorstr='@{upper}', endColorstr='@{bottom})',GradientType=1 )";
@emptyStr: "";
filter:e(@filterStr+@emptyStr);


来源:https://stackoverflow.com/questions/10324729/lesscss-ie-gradient-filter-with-variables-and-lighten

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!