AnswerBun.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!

Related Questions

Get to deeply nested object by array path of ids

3  Asked on November 7, 2021 by rgc998

 

How to consume dynamically created rabbit queues?

1  Asked on November 7, 2021 by laaf

   

Email draft – add recipients -Powershell

1  Asked on November 7, 2021 by konstantinos-v

   

Repo sync, fetches local credentials

0  Asked on November 7, 2021 by lecerof

     

SCSS generate classes from two arrays

1  Asked on November 7, 2021 by jekie

 

How to read the pem file in nodejs?

2  Asked on November 7, 2021 by raghul-sk

   

Singly linked List Find max,min

2  Asked on November 4, 2021 by lizzar_00

     

Deserializing json C# unexpected character encountered

1  Asked on November 4, 2021 by kjenn31

       

MySQL: Adding Calculated Column with IF ELSEIF

1  Asked on November 4, 2021 by thomasnngooglemailcom

     

Spring – Bean executes method twice

1  Asked on November 4, 2021 by bishonen_pl

   

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir