我写了这个跟随LESS网站的文档,mixins部分,我认为它可以工作,但引发语法错误:
SyntaxError: properties must be inside selector blocks, they cannot be in the
root. in less/style.less on line 3, column 3:
2 .bg (@x; @y) {
3 background-position: unit(@x, px) unit(@y, px);
4 }
Run Code Online (Sandbox Code Playgroud)
这是Less:
.bg (@x; @y) {
background-position: unit(@x, px) unit(@y, px);
}
.mydiv (@x:0; @y:-52; @width:300px; @height: 155px) {
.bg(@x, @y);
width: @width;
height: @height;
opacity: 1;
}
.mydiv()
Run Code Online (Sandbox Code Playgroud)
另外,如果我只使用多个参数,则会导致相同的错误:
SyntaxError: properties must be inside selector blocks, they cannot be in the
root. in less/style.less on line …Run Code Online (Sandbox Code Playgroud)