[英]output % with less
總之,我有一些代碼做了一個循環。 但是,如果我將px
更改為'%',則編譯較少的文件就越少。我可以制作它嗎? 謝謝。
@iterations: 100;
// helper class, will never show up in resulting css
// will be called as long the index is above 0
.loopingClass (@index) when (@index > 0) {
// create the actual css selector, example will result in
// .myclass_30, .myclass_28, .... , .myclass_1
(~".span@{index}") {
// your resulting css
width: @index px;//can not change px to % , please help me.
}
// next iteration
.loopingClass(@index - 1);
}
// end the loop when index is 0
.loopingClass (0) {}
// "call" the loopingClass the first time with highest value
.loopingClass (@iterations);
我找到了 !
width: percentage(@index *0.01);
謝謝
很高興你找到了解決方案。 這是另一種方法:
width: @index*1%
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.