How to Use Mixins in Sass and Pass Arguments – With Code Examples

PHOTO EMBED

Sat Jan 08 2022 02:23:05 GMT+0000 (Coordinated Universal Time)

Saved by @wnakswl #mixin #scss #text

@mixin text($font-size,$color,$bg-color) {

     // we pass the $font-size to font-size property
    font-size: $font-size;
    
    // we pass the $color to color property
    color: $color;
    
    // we pass the $bg-color to background property
    background: $bg-color;
}



.text1 {
          // ($font-size,$color,$bg-color)
    @include text(3rem,green , black)
}

.text2 {
          // ($font-size,$color,$bg-color)
    @include text(5em,red , transparent)
}
content_copyCOPY

https://www.freecodecamp.org/news/how-to-pass-arguments-to-mixins/