关于更少的循环,抛出错误

时间:2014-06-27 08:49:23

标签: loops less

.loop (@start, @end, @step, @className,@propertyName) when (@start < @end) {
  .@{className}-@{start} {
    @{propertyName}: @start * 1px;
  }
  .loop (@start + @step, @end, @step, @className, @propertyName);
}


.loop(12,48,2,fs,font-size);

我想要循环css公共类,但抛出错误,我不在错误的位置。 例如:

.fs-12{
font-size:12px;
}

.fs-13{
font-size:13px;
}

.mt-13{
margin-top:13px;
}

1 个答案:

答案 0 :(得分:-1)

.loop (@start, @end, @step, @className,@propertyName) when (@start < @end) {
  .@{className}-@{start} {
    @{propertyName}: (@start * 1px);
  }
  .loop ((@start + @step), @end, @step, @className, @propertyName);
}



 .loop(12,48,2, fs, font-size);