I'm putting together some CSS/SASS for menu from html that has been supplied to me. When I'm on a page about Red Apples, the html looks something like this:
<ul class="navigation">
<li class="active"><a href="#">Fruit</a>
<ul>
<li>Banana
<ul>
<li><a href="#">Yellow</a></li>
<li><a href="#">Green</a></li>
</ul>
</li>
<li class="active"><a href="#">Apple</a>
<ul>
<li><a href="#">Green</a></li>
<li class="active"><a href="#">Red</a></li>
<li><a href="#">Yellow</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#">Vegetables</a></li>
</ul>
When I'm on a page about Apples, there is no active
class on the colours, so that portion might look like this:
<li class="active"><a href="#">Apple</a>
<ul>
<li><a href="#">Green</a></li>
<li class="active"><a href="#">Red</a></li>
<li><a href="#">Yellow</a></li>
</ul>
</li>
Likewise, if I'm on a page about fruit, the Apples list item will lose its active
class.
My question is, given this markup, is there a way using just CSS/SASS to apply a background colour only the lowest instance of the active
class?
Edit: Here's a fiddle