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 - 那些是整數的步驟。關閉,但沒有雪茄,當然?!我在談論半數,安全地表示在班級名稱中,而不使用。 (明顯的原因,哈哈!) –