关于 sass 的 Mixins



 @mixin floorWal($w,$h,$img) {
  width: $w;
  height: $h;
  background: url(./images/$img) no-repeat center;
}

如上 $img 是不执行的 该如何 传入才 可生效呢

生成如下 css


 width: 105px;
    height: 105px;
    background: url(images/$img) center no-repeat;

sass 大神指导一下

解决如下


 @mixin floorWal($w,$h,$img) {
  width: $w;
  height: $h;
  background: url(./images/#{$img}) no-repeat center; 
}

sass css scss

蛋蛋皮破了 8 years, 10 months ago

Your Answer