I want to generate multiple values for a single property:
background-image:
radial-gradient(circle, $primary 10%, transparent 10%),
radial-gradient(circle, $primary 10%, transparent 10%),
radial-gradient(circle, $primary 10%, transparent 10%),
radial-gradient(circle, $primary 10%, transparent 10%);
I tried to achieve this by doing this:
background-image:
@for $i from 1 to 5 {
radial-gradient(circle, $primary 10%, transparent 10%),
}
However, this doesn't work. Any help would be appreciated!
Just declare a variable before and use it after all your logic.
BTW, you can play also with the $i and colors like $color#{$i}.
.gradient{
$color1: #000;
$color2: #fff;
$background: null;
@for $i from 1 through 4 {
$background: $background radial-gradient(circle, $color1 10%, $color2 10%)#{if($i !=4, ',', '')};
}
background-image: $background;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With