scss-@else if指令
@else if语句用来与@if指令一起使用。当 @if 语句失败时,则 @else if 语句测试,如果它们也无法测试满足时再 @else 执行。
语法:
@if expression { // CSS codes } @else if condition { // CSS codes } @else { // CSS codes }
scss代码实例:
$type: audi; p { @if $type == benz { color: red; } @else if $type == mahindra { color: blue; } @else if $type == audi { color: green; } @else { color: black; } }
编译后的css代码如下:
p { color: green; }
一步一个脚印,认真学下去,相信我们都会成为心目中的技术大牛!!!加油!!!

浙公网安备 33010602011771号