Reputation: 5508
I want to setup a dynamic font-size counted from rem value for all my headers and I want to do this in for loop. My problem is that I don't know how to divide number to get this result:
For loop:
@for $i from 1 through 6 {
h#{$i} {
margin-bottom: 1.4rem;
line-height: (2.8rem / 1.33333333333);
font: {
size: 3.2rem - ($i * 0.8);
family: $header-font;
}
}
}
Upvotes: 0
Views: 411
Reputation: 765
Why dont use an array of possible values instead of creating an algorithm returning the right number. You can create an array with $myArray: (1,2,3,4)
and use it like this nth($myArray, $i+1)
- see following post Accessing an array key in SASS
Upvotes: 1