This question already has an answer here:
- Is there a “previous sibling” selector? 15 answers
How do I target the list element individually, for example I would like to make:
Html:
<ul class="roundabout-holder">
<li class="roundabout-moveable-item"></li>
<li class="roundabout-moveable-item"></li>
<li class="roundabout-moveable-item roundabout-in-focus"></li>
<li class="roundabout-moveable-item"></li>
<li class="roundabout-moveable-item"></li>
<li class="roundabout-moveable-item"></li>
</ul>
Css:
.roundabout-in-focus{
font-size:1em;
}
.roundabout-in-focus.prev(),
.roundabout-in-focus.next(){
font-size:.9em;
}
.roundabout-in-focus.prev().prev(),
.roundabout-in-focus.next().next(){
font-size:.8em;
}
.roundabout-in-focus.prev().prev().prev(),
.roundabout-in-focus.next().next().next(){
font-size:.7em;
}
That means the further away the .roundabout-in-focus, the smaller the list element's font size.