【发布时间】:2015-04-24 15:35:26
【问题描述】:
我有几种颜色设置为类
.black {background: $black;};
.red {background: $red;}
.yellow {background: $yellow;}
.grey {background: $grey;}
.white {background: $white;}
.blue {background: $blue;}
.full-black {background: #000;}
.light-black {background: #222;}
但我想创建一个 mixin,它采用类名并自动创建类名并填充背景颜色,所以我不必每次都输入它..
我尝试过类似的方法
@mixin colours ($black,$full-black,$light-black,$red,$blue,$yellow,$white,$grey) {
.(colours): background:{colours};
}
但无法找出正确的代码。
【问题讨论】:
-
您是否也在 Less 中寻找答案?请澄清。
-
你不需要一个 mixin 但每个都需要,看看我的回复 ;)
标签: sass