Using SCSS to make 4 boxed li
elements darken their color. I can do this manually with classes but that defeats the purpose of semantics. Trying to create a @for function to handle this but I've not found any resources to do what I need.
This is my desired outcome that I want to automate through SCSS:
HTML:
<ul>
<li>
<h2>Title</h2>
<img>
<p></p>
<a class="button"></a>
</li>
<li>
<h2>Title</h2>
<img>
<p></p>
<a class="button"></a>
</li>
<li>
<h2>Title</h2>
<img>
<p></p>
<a class="button"></a>
</li>
<li>
<h2>Title</h2>
<img>
<p></p>
<a class="button"></a>
</li>
</ul>
SCSS:
li {
&.one {
background: $primary-color
}
&.two {
background: darken($primary-color, 4%);
}
&.three {
background: darken($primary-color, 8%);
}
&.four {
background: darken($primary-color, 12%);
}
}
There has to be a way to automate this without using classes ... maybe an incremental? Add 4% on ... ? This is where I get lost ...
Can anyone assist and explain their code? I have no idea how to even start.