CSS highlight menu item based on page body tags
- by Sai
I have a menu, I would like to highlight the sub menu item based on the page they are in. Can I use a div tag with an id on the page, and in css if the id is there then highlight the item.
in body
<div id="doc3"></div>
then in css
#doc3 #menu li#subnav-5-1 a
I tried this but dosent seem to work. How can I change the style of another element based on id in the page body?
menu...
<!-- Menu 5 -->
<li id="nav-5"><a href="ssslate.do">Micro</a>
<ul id="subnav-5">
<li class="subnav-5-1"><a href="asdf.do">Site & Visit</a></li>
<li><a href="ss.do">MIC</a></li>
<li><a href="ss.do">sss</a></li>
</ul>
</li>
CSS
body.nav-5-1 li.subnav-5-1 {background-color:red;}
htmlbody
<body id=nav-5-body class="nav-5-1">
Thanks