在SASS中可以使用else if吗?
如下所示:
if(1+1 = 1) {
} else if(2+1=4) {
} else {
}我有以下情况,但它不起作用:
$color: "blue", "green", "orange", "red", "pink", "grey", "black"
@for $i from 1 through length($color)
.color-#{ nth($color, $i) }
@if nth($color, $i) == "pink" or "grey"
color: #f00
@else if nth($color, $i) == "black"
color: #0f0
@else if nth($color, $i) == "orange"
color: #000
@else
color: #fff发布于 2015-02-27 02:35:03
根据SASS参考:Yes, is it possible。
甚至很多次:
萨斯:
p
@if $type == ocean
color: blue
@else if $type == matador
color: red
@else if $type == monster
color: green
@else
color: blackSCSS:
p {
@if $type == ocean {
color: blue;
} @else if $type == matador {
color: red;
} @else if $type == monster {
color: green;
} @else {
color: black;
}https://stackoverflow.com/questions/28749974
复制相似问题