2013-03-06 22 views
0

所有的,我有一些代碼少做一個循環。但是,如果我將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 
    (~"[email protected]{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); 

回答

1

很高興你找到了解決辦法。這是另一種方式:

width: @index*1% 
+0

謝謝!無論如何。 – 2013-03-07 01:29:55

1

我發現它!

width: percentage(@index *0.01); 

感謝