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

Pandas dataframe only select the columns that have all True

2  Asked on December 11, 2020 by learningisfun

     

I want to create fixed sidebar but scroll does not work

5  Asked on December 11, 2020 by nav

     

How can I extract all PDF Tags related to content with Python?

2  Asked on December 11, 2020 by martin-thoma

   

React Fizz-Buzz

2  Asked on December 11, 2020 by kamil-kos

   

Update Subform based on Form Combo Box

0  Asked on December 10, 2020 by hazat-bangurah

   

Determine if __getattr__ is method or attribute call

3  Asked on December 10, 2020 by robin-orheden

   

How to implement category axis in matplotlib?

0  Asked on December 10, 2020 by fgg1991

   

Pre-fill the checkbox with url

2  Asked on December 10, 2020 by sevenine

       

Shell=false generates OsError

1  Asked on December 10, 2020 by azza-abidi

       

LINQ query orderBy a subquery

2  Asked on December 9, 2020 by golfbravo

       

Ask a Question

Get help from others!

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