Answer the question
In order to leave comments, you need to log in
How to generate nesting in Sass?
I just read into the cycles, but I'm already stagnant
Here is the css code
.collapsible:nth-child(n)
.collapsible-header {
background: red
}
.collapsible:nth-child(n)
.collapsible:nth-child(n)
.collapsible-header {
background: yellow
}
.collapsible:nth-child(n)
.collapsible:nth-child(n)
.collapsible:nth-child(n)
.collapsible-header {
background: green
}
..
$sel: ".collapsible:nth-child(n)";
$r: 255;
$g: 248;
$b: 224;
@for $i from 1 through 7 {
#{$sel} .collapsible-header { {
background: rgb( $r+($i*3), $g+($i*3), $b+($i*3) );
}
$sel = $sel + $sel; // ошибка синтаксиса
}
Answer the question
In order to leave comments, you need to log in
$sel: ".collapsible:nth-child(n)";
$r: 255;
$g: 248;
$b: 224;
@for $i from 0 through 7 {
#{$sel} .collapsible-header {
background: rgb( $r+($i*2), $g+($i*2), $b+($i*2) );
}
$sel: #{$sel} #{".collapsible:nth-child(n)"};
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question