css - Target samelevel and parent lis -
i have example: http://jsfiddle.net/4eblu/
html:
<ul> <li><a href="">great britain</a></li> <li><a href="">germany</a></li> <li> <a href="">france</a> <ul> <li> <a href="">paris</a> <ul> <li><a href="">notre dame</a></li> <li class="selected"><a href="">parc des princes</a></li> <li><a href="">sacre coeur</a></li> </ul> </li> <li><a href="">rouen</a></li> <li><a href="">lyon</a></li> <li><a href="">marseilles</a></li> </ul> </li> <li><a href="">sweden</a></li> <li><a href="">poland</a></li> </ul>
css:
.selected > :first-child { color: #f00; background-color: #999; }
this style tag "parc des princes" red grey background.
is there way css target tags on same level tag inside .selected li , tags in parent levels? in other words want make every tag relating france , tag france have color: #f00;
the html must kept intact cause cant change , must done css only.
cheers / robin.
sounds want access parent selector, cannot done using css alone, can read on more here, there other selectors can find handy : siblings,universal,etc
Comments
Post a Comment