css预处理脚本的用处是生成可维护的css样式。不过比较尴尬的是,大网站不屑于,小网站不需要。用的比较多的领域是开发框架和样式自定义。
2016-10-09
@mixin class{
@each $key,$vaule in $list{
ul.#{$key}{
@include swatchesLighten($vaule);
@include swatchesDarken($vaule);
li:nth-child(11) {
background-color: $vaule;
}
}
}
}
@include class;
@each $key,$vaule in $list{
ul.#{$key}{
@include swatchesLighten($vaule);
@include swatchesDarken($vaule);
li:nth-child(11) {
background-color: $vaule;
}
}
}
}
@include class;
2016-09-27
给每个li加样式,这样更方便:
$list:(
red:$redBase,
orange:$orangeBase,
yellow:$yellowBase,
green:$greenBase,
blue:$blueBase,
purple:$purpleBase,
black:$blackBase
);
$list:(
red:$redBase,
orange:$orangeBase,
yellow:$yellowBase,
green:$greenBase,
blue:$blueBase,
purple:$purpleBase,
black:$blackBase
);
2016-09-27
@mixin border{
$index:1;
@each $var in zip(1px 2px 3px,solid dashed dotted,green blue red){
.border#{$index}{
border:$var;
}
$index:$index+1;
}
}
@include border;
$index:1;
@each $var in zip(1px 2px 3px,solid dashed dotted,green blue red){
.border#{$index}{
border:$var;
}
$index:$index+1;
}
}
@include border;
2016-09-27