2
有没有办法做到这一点?如何覆盖SCSS for循环中的整数步骤(从*到*)
SCSS:(须藤代码)
@for $i from 0 through 10 (increment:0.5) {
.bottom-#{$i} {
bottom: 1em * $i;
}
}
CSS输出:
.bottom-0 {
bottom: 0em;
}
.bottom-05 {
bottom: 0.5em;
}
.bottom-1 {
bottom: 1em;
}
.bottom-15 {
bottom: 1.5em;
}
.bottom-2 {
bottom: 2em;
}
我基本上是想for循环通过迭代到十增量为0.5,就像在输出的东西上面的css代码块,没有包含在类名中的.5,因为它将它视为嵌套类。
@cimmanon - 这是松散的关系到你这个标记对作为一个重复的问题。请重新考虑。 –
我会重新考虑的唯一事情是我对重复的选择。 http://stackoverflow.com/questions/18802148/sass-for-directive-how-to-use-steps-in-loops – cimmanon
@cimmanon - 那些是整数的步骤。关闭,但没有雪茄,当然?!我在谈论半数,安全地表示在班级名称中,而不使用。 (明显的原因,哈哈!) –