Answer the question
In order to leave comments, you need to log in
How to make an incremented value in SCSS?
Is it possible to use SASS to gradually increase indentation? Those. each next value should be 5px to the left. Unfortunately, nothing smarter than in the example came to mind, but that's not it.
Here is the code:
@mixin last-childs {
@for $i from 2 through 7 {
&:nth-last-child(#{$i}) {
margin-left: calc(40px - #{$i}px);
}
}
}
&:nth-last-child(7) {
margin-left: 10px;
}
&:nth-last-child(6) {
margin-left: 15px;
}
&:nth-last-child(5) {
margin-left: 20px;
}
&:nth-last-child(4) {
margin-left: 25px;
}
&:nth-last-child(3) {
margin-left: 30px;
}
&:nth-last-child(2) {
margin-left: 35px;
}
&:last-child {
margin-left: 40px;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question