I want to append style on a class depending on the value in the parents data-attribute.
In my case, rating starts.
If data-rating is for ex. 3, the first three starts should be filled with a color.
I assume nth-child will do the trick, but i can't manage it to work..
This is my html:
<div class="container">
<div class="rating" data-rating="3">
<span class="star" data-score='1'></span> /* Filled */
<span class="star" data-score='2'></span> /* Filled */
<span class="star" data-score='3'></span> /* Filled */
<span class="star" data-score='4'></span>
<span class="star" data-score='5'></span>
</div>
</div>
I'm using sass.
Thx!