很奇怪,less中对减号似乎没有特别说明,很容易让人无用。

 

@div1Width:500;

@div2Width:200px;

.div3cls
{
   width:@div1Width-@div2Width;
}

 

 

 

会报nameerror错误:NameError: variable @div1Width- is undefined in  XXXXX

解决这个问题的方法就是@div1Width-@div2Width中每个变量加上括号。因为在css中”-“允许出现在类命名和声明中的。

改成

 

.div3cls
{
    width:(@div1Width)-(@div2Width);
}

 

 

 

 

相关文章:

  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
猜你喜欢
  • 2021-06-13
  • 2022-02-11
  • 2022-12-23
  • 2021-11-06
  • 2021-08-05
  • 2022-12-23
  • 2021-08-18
相关资源
相似解决方案