Set a variable in Sass depending on the selector

前端 未结 8 1122
失恋的感觉
失恋的感觉 2020-12-10 10:20

I’ve got a website that’s using a few different ‘main’ colors. The general HTML layout stays the same, only the colors change depending on the content.

I was wonderi

8条回答
  •  一个人的身影
    2020-12-10 10:49

    UPDATE: its 2017 and variables does works!

    @mixin word_font($page) {
      @font-face {
        font-family: p#{$page};
        src: url('../../static/fonts/ttf/#{$page}.ttf') format('truetype');
        font-weight: normal;
        font-style: normal;
      }
    
      .p#{$page} {
       font-family: p#{$page};
      }
    }
    
    // Loop and define css classes 
    @for $i from 1 through 604 {
     @include word_font($i);
    }
    

提交回复
热议问题