我需要的是一个从1到100的递增列表:(+0.25)
这是我的代码:
.width-0_0em {width: 0em; }
.width-0_25em {width: 0.25em; }
.width-0_50em {width: 0.5em; }
.width-0_75em {width: 0.75em; }
.width-1em {width: 1em; }
.width-1_25em {width: 1.25em; }
.width-1_50em {width: 1.5em; }
.width-1_75em {width: 1.75em; }
.width-2em {width: 2em; }
这是我的代码:
$max: 1 * 100;
$step: 1 ;
$zero: 0;
$twentyfive: 1 * 25 ;
$fifteen: 1 * 50 ;
$seventyyfive: 1 * 75 ;
@for $i from $step through ceil($max/$step) {
$value: ($i - 1) * $step + 0;
.width-#{$value}_#{$zero}em {
width: #{$value}em;
}
.width-#{$value}_#{$twentyfive}em {
width: $i * 0.25em;
}
.width-#{$value}_#{$fifteen}em {
width: $i * 0.5em;
}
.width-#{$value}_#{$seventyyfive}em {
width: $i * 0.75em;
}
.width-#{$value}em {
width:($i - 1) * $step + 1em;
}
}
}
请问有人能帮我看一下这段代码吗?我不知道哪里出了问题...如果有在fiddle或类似平台上的示例,将不胜感激。