Does SASS support adding !important to all properties in a mixin?

后端 未结 3 1485
星月不相逢
星月不相逢 2021-01-07 19:21

I am currently using the compass framework and all it\'s helpful CSS3 mixins. I would like to use the border-radius(5px) mixin and have all properties that come

3条回答
  •  天命终不由人
    2021-01-07 20:08

    Mixin:

    @mixin verlauf($color1, $color2) {
      background: $color1;
      background: -moz-linear-gradient(top, $color1 0%, $color2 100%);
      background: -webkit-linear-gradient(top, $color1 0%,$color2 100%);
      background: linear-gradient(to bottom, $color1 0%,$color2 100%);
    }
    

    SCSS:

     @include verlauf(#607a8b !important, #4b6272 !important);
    

    Result:

    background: #607a8b !important;
    background: -moz-linear-gradient(top, #607a8b !important 0%, #4b6272 !important 100%);
    background: -webkit-linear-gradient(top, #607a8b !important 0%, #4b6272 !important 100%);
    background: linear-gradient(to bottom, #607a8b !important 0%, #4b6272 !important 100%); }
    

    It works also with a two (and more) variable mixin!

提交回复
热议问题