2013-03-06 4 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: percentage(@index *0.01); 

덕분에 당신은 해결책을 발견. 여기에 다른 방법이 있습니다.

width: @index*1% 
+0

고마워요! 어쨌든. –

1

발견!