less 学习

1.~

将 字符串中的“ 给去掉

@index:2;     @aa:~ ".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}";

调用

@{aa}{     position:relative; }

 生成css

.col-xs-2, .col-sm-2, .col-md-2, .col-lg-2 {
  position: relative;
}

2.{index}

在字符串中链接变量

3.循环when

.text(@index) when (@index < 4){   .textcss{  -col@{index}{color:blue;}   }   .text(@index+1) }

.text(1);

css

.textcss -col1 {
  color: blue;
}
.textcss -col2 {
  color: blue;
}
.textcss -col3 {
  color: blue;
}

原文地址:https://www.cnblogs.com/lavenvsxiaoye/p/4606285.html