已采纳回答 / 慕勒4070690
.test{ width:min(1,50,1%,3,300%,1)}结果是最后一个1,在这个函数里面是没有单位的比较,不会因为有百分号就除以一百,他会取最后一个数字最小的。如果换成下面这样.test{ width:min(1,50,1%,3,300%)}结果是1%
2017-01-12
@which
$types: 4;
$type-width: 20px;
@while $types > 0 {
.while-#{$types} {
width: $type-width + $types;
}
$types: $types - 1;
}
@for $i from 4 through 1{
.while-#{$i}{
width:$type-width + $i
}
}
$types: 4;
$type-width: 20px;
@while $types > 0 {
.while-#{$types} {
width: $type-width + $types;
}
$types: $types - 1;
}
@for $i from 4 through 1{
.while-#{$i}{
width:$type-width + $i
}
}
2016-12-26
$list: archer saber lancer caster rider;
@each $eachTest in $list{
.nav.#{$eachTest}{
width: 10px;
background-image: url("imagers/#{$eachTest}.png");
}
}
@each $eachTest in $list{
.nav.#{$eachTest}{
width: 10px;
background-image: url("imagers/#{$eachTest}.png");
}
}
2016-12-19
@mixin ifTest($test:true,$test2:true){
@if $test{
width: $test;
}
@else if $test2{
height: $test2;
}
@else{
width: 50px;
height: 50px;
}
}
.boxs{
@include ifTest(10px)
}
.boxs2{
@include ifTest(false,20px)
}
.boxs3{
@include ifTest(false,false)
}
@if $test{
width: $test;
}
@else if $test2{
height: $test2;
}
@else{
width: 50px;
height: 50px;
}
}
.boxs{
@include ifTest(10px)
}
.boxs2{
@include ifTest(false,20px)
}
.boxs3{
@include ifTest(false,false)
}
2016-12-19