Answer the question
In order to leave comments, you need to log in
What is the correct way to write @for in SASS for a property value?
Hello.
Can you please tell me how to write @for for the property value?
I wrote simpler ones, but I have not come across this one yet.
There are thoughts to implement on the mixin.
What an enumeration that does not work should look like:
box-shadow:
@for $i from 1 through 50{
$basis:16 * $i;
@if #{$i} == 50{
($basis)px 0 0 currentColor
}
else{
($basis)px 0 0 currentColor,
}
}
;
box-shadow:
-16px 0 0 currentColor,
-32px 0 0 currentColor,
-48px 0 0 currentColor,
-64px 0 0 currentColor,
-80px 0 0 currentColor
...
;
Answer the question
In order to leave comments, you need to log in
@mixin long-shadow() {
$shadow: "16px 0 0 currentColor";
@for $i from 2 through 50 {
$basis: 16 * $i;
$shadow: #{$shadow}, #{$basis}px 0 0 currentColor;
}
box-shadow: $shadow;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question