$red:"#111", "#222", "#333";
$orange: "#444", "#555","#666";
$green: "#777","#888","#999";
$color-collection: $red, $orange, $green;
@each $color in $color-collection {
.color {
@for $i from 1 through length($color-collection) {
$c: nth($color-collection, $i);
.colours--#{$i} {
background: $c;
}
}
}
}
輸出打印所有顏色,薩斯如何訪問變量列表
.color .colours--1 {
background: "#111", "#222", "#333";
}
.color .colours--2 {
background: "#444", "#555", "#666";
}
.color .colours--3 {
background: "#777", "#888", "#999";
}
我想打印爲@each,所以如何訪問$color-collection
的$red
?看起來不像這樣$color-collection[$red]
我想打印像下面
.color .colours--1 {
background: "#111";
}
.color .colours--2 {
background: "#222";
}
.color .colours--3 {
background: "#333";
}
等