Passing list elements as arguments to a mixin

前端 未结 1 561
一向
一向 2021-01-03 09:37

The following code works except for when I try to pass the $gradient to @include background-image.

@mixin compositeFill($size: 100p         


        
相关标签:
1条回答
  • 2021-01-03 10:15

    To pass a list of parameters to a mixin that accepts multiple parameters you would want to use it like this:

    @include background-image(linear-gradient($gradient...));
    

    the three dots indicate that you want to fill in the arguments from the list elements ... otherwise the whole list is passed as a single argument ... and the linear-gradient() mixin fails (as it expects at least two color stop arguments).

    DEMO

    0 讨论(0)
提交回复
热议问题