1.代码
ul {
$style: (color: #fb3,
fontSize: 30px);
li:nth-child(1) {
color: map-get($style, 'color');
font-size: map-get($style, 'fontSize');
}
$colors: red green blue;
$padding: 5px 10px 5px 10px;
li:nth-child(1) {
color: nth($colors, 1);
padding: $padding;
}
$n1: 20;
$fontSize: 30px;
li:nth-child(2) {
font-size: $n1 + px;
}
li:nth-child(3) {
font-size: $fontSize;
}
$s1: 'success';
$s2: 'error';
$s3: 'warning';
.#{$s1} {
color: green;
}
.#{$s2} {
color: red;
}
.#{$s3} {
color: yellow;
}
$t: true;
$f: false;
li:nth-child(4) {
@if $t {
background: brown;
}
@else {
background: yellow;
}
}
$null: null;
li:nth-child(4) {
@if $null==null {
padding: 10px;
}
}



2.总结