0
0
SASSmarkup~5 mins

Grid column generator with loops in SASS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of using loops in a Sass grid column generator?
Loops in Sass help create multiple grid column classes automatically, saving time and avoiding repetitive code.
Click to reveal answer
beginner
How do you write a basic @for loop in Sass?
You write it like this:<br>
@for $i from 1 through 4 {<br>  .col-#{$i} {<br>    width: 100% / 4 * $i;<br>  }<br>}
Click to reveal answer
beginner
What does #{$i} do inside a Sass loop?
It inserts the current loop number into the class name or property, making each class unique like <code>.col-1</code>, <code>.col-2</code>, etc.
Click to reveal answer
beginner
Why is using a grid column generator with loops better than writing each column class manually?
It reduces errors, saves time, and makes your code easier to update and maintain.
Click to reveal answer
beginner
What CSS property is commonly used to set the width of grid columns in a generator?
The width property is used to set how wide each column should be, often calculated as a fraction of the total grid width.
Click to reveal answer
In Sass, which directive is used to create a loop for generating grid columns?
A@for
B@if
C@while
D@each
What does through mean in @for $i from 1 through 4?
AStarts at 0
BStops before 4
CIncludes 4 in the loop
DLoops infinitely
How do you insert the loop variable into a class name in Sass?
A@{$i}
B#{$i}
C$i
D${i}
If you want 12 equal grid columns, what width should each column have?
A8.33%
B12%
C10%
D6.25%
Which CSS property is typically used to control the size of grid columns generated by Sass loops?
Aheight
Bpadding
Cmargin
Dwidth
Explain how to create a grid column generator using a Sass loop.
Think about how to repeat similar CSS rules with different numbers.
You got /4 concepts.
    Why is using loops in Sass helpful when building grid systems?
    Consider how writing many similar classes manually can be tedious.
    You got /4 concepts.