gpt4 book ai didi

css - 输出 % 少

转载 作者:太空宇宙 更新时间:2023-11-04 04:42:11 27 4
gpt4 key购买 nike

全部,我有一些代码在 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);

最佳答案

很高兴您找到了解决方案。这是另一种方法:

width: @index*1%

关于css - 输出 % 少,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15241753/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com