【发布时间】:2013-10-17 10:48:06
【问题描述】:
我是按照 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 }
这是少:
.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()
如果我只使用多个参数,也会导致同样的错误:
SyntaxError: properties must be inside selector blocks, they cannot be in the
root. in less/style.less on line 14, column 3:
13 .mydiv(@width:300px; @height: 155px) {
14 background-position: 0px -52px;
15 width: @width;
减:
.mydiv (@width:300px; @height: 155px) {
background-position: 0px -52px;
width: @width;
height: @height;
opacity: 1;
}
.mydiv()
我不知道它有什么问题...请帮助...
引用:我在 Windows 8.1 x64 中使用更少的 grunt-contrib-less 和更少的 1.4.2。
【问题讨论】: