开发者

Radial gradient mixin in LESS isn't working?

开发者 https://www.devze.com 2023-04-07 22:38 出处:网络
If you are familiar with less, could you help me with this problem? I am creating a radial gradient mixin for just a quick test case.

If you are familiar with less, could you help me with this problem? I am creating a radial gradient mixin for just a quick test case. However both are not working?

.radialGradient(@posX:center @posY:center, @shape:circle @size:closest-side, @from:white, @to:black){
    background-image: -webkit-radial-gradient(@arguments);
}

or

.radialGradient(@posX:center @posY:center, @s开发者_如何学运维hape:circle @size:closest-side, @from:white, @to:black){
    background-image: -webkit-radial-gradient(@posX @posY, @shape @size, @from, @to);
}

Reasons?

Thanks!


Ah! I figured out. I have forgotten to add in "," in the parameters.

.radialGradient(@posX:center, @posY:center, @shape:circle, @size:closest-side, @from:white, @to:black){
    background-image: -webkit-radial-gradient(@posX @posY, @shape @size, @from, @to);
}

This is the right way.


They changed LESS PHP to match LESS JS in regards to parameter syntax. Values used to be separated by ; now they are separated by ,


Ah, I've discovered the solution. You forgot to add a comma after your first parameter ;P

.radialGradient(@posX:center, @posY:center, @shape:circle, @size:closest-side, @from:white, @to:black){
    background-image: -webkit-radial-gradient(@posX @posY, @shape @size, @from, @to);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消