0

すべて、私はいくつかのコードをlessでループさせています。しかし、px「%」に変更すると、less は less ファイルをコンパイルできません。どうすれば作成できますか? ありがとう。

@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);
4

2 に答える 2

1

解決策を見つけてよかったです。これを行う別の方法を次に示します。

width: @index*1%
于 2013-03-06T13:39:15.537 に答える
1

見つけた !

width: percentage(@index *0.01);

ありがとう

于 2013-03-06T07:52:51.850 に答える