Answer the question
In order to leave comments, you need to log in
How to organize mixin by IDs?
Good afternoon!
Tell me how to implement a mixin or function, provided:
1. there are several scss variables that only change the ending:
$var1 = #333
$var5 = #111
$var100 = #222
...
...
...
2. there are several divs with the same IDs:
div id="var1"
div id="var5"
div id="var100"
...
...
...
You need to build a mixin / function so that the color of the text in the div matches the variable.
In order not to write values for each div separately
Answer the question
In order to leave comments, you need to log in
Who forced you to create a bunch of variables of the same type, if there are arrays for this? Or, in sass terminology, maps.
$colors: {
1: #333,
5: #111,
100: #222,
}
@each $index, $color in $colors {
#var#{$index} {
color: $color;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question