Multiple two-class selectors in Sass

后端 未结 4 1904
盖世英雄少女心
盖世英雄少女心 2021-01-31 13:59

Having multiple two-class selectors for a single declaration block, is it possible to simplify the following (i.e. not having to repeat the body tag):



        
4条回答
  •  北海茫月
    2021-01-31 14:32

    In this case we can use @each directive:

    $pages: shop, contact, about, faq;
    
    body {
      @each $page in $pages {
        &.#{$page} {
          background-color:#FFF;
        }
      }
    }
    

    sassmeister.com

提交回复
热议问题