Generic @mixin for sass with multiple and varied values

前端 未结 1 674
星月不相逢
星月不相逢 2020-12-20 08:12

how do I create a generic @mixin in sass for multiple values with comma , and user might not now know how many values would each include of mixin would have?

相关标签:
1条回答
  • 2020-12-20 08:41

    From the official documentation:

    Sass supports “variable arguments,” which are arguments at the end of a mixin declaration that take all leftover arguments and package them up as a list. These arguments look just like normal arguments, but are followed by .... For example:

    @mixin box-shadow($shadows...) {
      -moz-box-shadow: $shadows;
      -webkit-box-shadow: $shadows;
      box-shadow: $shadows;
    }
    
    .shadows {
      @include box-shadow(0px 4px 5px #666, 2px 6px 10px #999);
    }
    
    0 讨论(0)
提交回复
热议问题