Hi, I am having a lot of difficulties turning on the active state when a page is being viewed.
Ideally, I would like the menu tab to be on the blue hover state when a page has been selected from the menu.
So far I cant get his to work.
Here is my menu code:
Code CSS:.menu{ border:none; width:950px; border:0px; margin:0px; padding:0px; font: 60% "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif; font-size:12px; font-weight:bold; } .menu ul{ background:#3e4c55; height:35px; list-style:none; margin:0; padding:0; } .menu li{ float:right; padding:0px; } .menu li a{ background:#3e4c55 url("images/seperator.gif") bottom right no-repeat; color:#fff; display:block; font-weight:normal; line-height:35px; margin:0px; padding:0px 20px; text-align:center; text-decoration:none; } .menu li a:hover, .menu ul li:hover a { background: #017ac1 url("images/hover.gif") bottom center no-repeat; color:#FFFFFF; text-decoration:none; } .menu li ul{ background:#3e4c55; display:none; height:auto; padding:0px; margin:0px; border:0px; position:absolute; width:160px; z-index:200; /*top:1em; /*left:0;*/ } /* -----------------SUB MENU------------------- */ .menu li:hover ul{ display:block; } .menu li li { background:url('images/sub_sep.gif') bottom left no-repeat; display:block; float:none; margin:0px; padding:0px; width:160px; } .menu li:hover li a{ background:none; } .menu li ul a{ display:block; height:35px; font-size:12px; font-style:normal; margin:0px; padding:0px 10px 0px 19px; text-align:left; } .menu li ul a:hover, .menu li ul li:hover a { background:#017ac1 url('images/hover_sub.gif') center left no-repeat; border:0px; color:#fff; text-decoration:none; } .menu p{ clear:right; }
And here is the code I have for the menu on my page:
Code HTML4Strict:<div class="menu"> <ul> <li><a href="contact.html" >CONTACT US</a></li> <li><a href="careers.html">CAREERS</a></li> <li><a href="events.html" >EVENTS</a></li> <li><a href="news.html">NEWS</a> <ul><li><a href="news.html">NEWS</a></li> <li><a href="profile.html">ARCHIVE</a></li> </ul></li> <li><a href="products.html" id="current">PRODUCTS</a> <ul> <li><a href="1.html">1</a></li> <li><a href="2.html">2</a></li> <li><a href="3.html">3</a></li> <li><a href="4.html">4</a></li> </ul> </li> <li><a href="about.html">ABOUT US</a></li> <li><a href="index.html" class="active">HOME</a></li> </ul> </div>
I realise I have some redundant code and I will fix this whenever I get the active to work.
Any help at all would be much appreciated, as I have been staring at this for a while now!
![]()









Bookmarks