【问题标题】:less unrecognized input border-radius较少无法识别的输入边界半径
【发布时间】:2017-08-24 23:56:24
【问题描述】:

我刚开始学得少。我将以下代码复制并保存到一个文件中,并尝试使用lessc对其进行编译。它给出了一个错误"ParseError: Unrecognized input"。我尝试了多种方式对其进行修改,但仍然找不到原因。谁能指出哪里出了问题?

.border-radius-custom(@radius:10px) {
    -webkit-border-radius: @radius;
    -moz-border-radius: @radius;
    border-radius: @radius;
}

我使用的是lessc 2.7.2

非常感谢。

【问题讨论】:

  • 如何编译?您的问题在其他地方,因为代码本身显然很好(期望它应该产生一个空结果)。请注意,编译器消息通常指向错误的确切点(“在第 xx 行第 yy 列”),此信息通常很有帮助。

标签: css less


【解决方案1】:

您的代码看起来不错。下面是它的工作演示。但是,这似乎是一个可能与其他原因有关的编译错误。你有任何错误输出吗?

.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);
}

【讨论】:

  • 非常感谢...通过将您的代码 sn-p 与我的代码进行比较,我发现了问题:我的 less 文件保存在 utf-8 中,并包含字符“C2A0”,看起来像我的空格编辑器。
猜你喜欢
  • 2013-02-20
  • 1970-01-01
  • 1970-01-01
  • 2014-04-30
  • 1970-01-01
  • 2014-02-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多