简体   繁体   中英

Sass mixin variable inside proprieties

I was using mixin proprieties in SASS an i was wondering if there were a way to use variables inside mixins. Here's a very simply example

SASS
    =overflow($axe,$show)
       overflow-$axe: $show

SCSS
  @mixin overflow($axe,$show){
    overflow-$axe: $show;
}

Thanks to all for further answers :)

Yes, it is possible and called interpolation:

@mixin overflow($axe,$show){
    overflow-#{$axe}: $show;
}

body {
    @include overflow('x', 'hidden');
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM