我开始学习的更少。我将以下代码复制并保存到文件中,并尝试使用lessc进行编译。它给出了错误"ParseError: Unrecognized input"
。我试图以多种方式修改它,但我仍然找不到原因。有人可以指出出了什么问题吗?
.border-radius-custom(@radius:10px) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
}
我正在使用lessc 2.7.2
非常感谢。
答案 0 :(得分:0)
您的代码似乎很好。下面是它工作的演示。但是,这似乎是一个编译错误,可能与其他东西有关。你有任何错误输出吗?
.container {
width: 400px;
height: 100px;
float: left;
background: #333;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
<div class="container"></div>
LESS会是什么样子
注意:在使用类时不需要指定像素宽度,这是为了证明如果要为一个类显式更改它,可以将其更改为其他值
.border-radius-custom(@radius:10px) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
}
.container {
width:400px;
height:100px;
float:left;
background:#333;
.border-radius-custom(10px);
}