TransWikia.com

Why does flex-basis calculation return an error in SASS?

Stack Overflow Asked by Simplicius on January 5, 2022

So I was quickly typing out a flex-grid generator in scss as I often do, but for some weird reason this returns an error now. From my assumption this is totally correct and should simply compile to the desired classes. I’m using a 12-col-grid system, this is my approach flex: 0 0 #{100 / 12 / $i}%;, I propably miss something really obvious. My Codepen.

@mixin colSpan {
  @for $i from 1 through 12 {
    .col-#{$i} {
      flex: 0 0 #{100 / 12 / $i}%;
      max-width: #{100 / 12 / $i}%;
    }
  }
}

@include colSpan;

One Answer

add the % to the 100

@mixin colSpan {
  @for $i from 1 through 12 {
    .col-#{$i} {
      flex: 0 0 #{100% / 12 / $i};
      max-width: #{100% / 12 / $i};
    }
  }
}

@include colSpan;

Answered by Temani Afif on January 5, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP