2013-03-06 2 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

Спасибо! так или иначе. –

1

Я нашел его!

width: percentage(@index *0.01); 

благодаря

Смежные вопросы