Hello, I am currently working on creating a mixin to assign values based on the margin position. I have made progress but am unsure of how to proceed further.
@mixin margin ($value, $positions...){
@each $position in $positions {
margin-#{$position}: $value;
}
}
.margin-top {
@include margin(10px, top);
}
.margin-multiple {
@include margin(10px, top, left, right);
}
When using the margin-multiple
selector, if three different values are passed, they should be attached to the respective margin positions. For example, by including
@include margin(10px, 8px, 5px, top, left, right);
the expected output would look like this:
.margin-multiple {
margin-top: 10px;
margin-left: 8px;
margin-right: 5px;
}
Any assistance on this matter would be greatly appreciated.