April 3, 200917 yr Hi, I nearly always use PHP includes for my navigational links to aid changes and maintenance to the site, and so the correct menu item is easily identifiable as the 'current' item. However, when I'm trying to apply that principle to this page (http://www.azuremarketing.com/clients/ocsl/web/safety-management.php), the whole of the dropdown menu appears to be 'selected'. I'm sure there's an easy work around, but I've just looked at it too much. I'd be really grateful if someone had any ideas about how I can rectify this (the 'capabilities' category is correct to look 'current', but the others in the dropdown box should be white). Any tips would be appreciated. Many thanks Vicky
April 3, 200917 yr Hi Vicky, I think it is because you are styling the <li> and not the <a>. This is your current code: #navigation li.active a, #navigation li a:hover{color:#fdc21c;} <li class="active"><a href="#">Capabilities</a> <ul> <li><a href="#">Safety Management</a></li> <li><a href="#">Risk Management</a></li> <li><a href="#">Project Management</a></li> <li><a href="#">Business Development</a></li> <li><a href="#">Bid Support</a></li> </ul> </li> Change it to this: #navigation li a.active, #navigation li a:hover{color:#fdc21c;} <li><a href="#" class="active">Capabilities</a> <ul> <li><a href="#">Safety Management</a></li> <li><a href="#">Risk Management</a></li> <li><a href="#">Project Management</a></li> <li><a href="#">Business Development</a></li> <li><a href="#">Bid Support</a></li> </ul> </li> -Ben
April 3, 200917 yr Author Hi Ben Thanks so much for looking at that for me. You were right, that is why it wasn't working properly. However, having now switched it over to styling the <a> rather than the <li> means that the 'active' colour no longer works, ie: this part of the code: <li <?php if ($thisPage=="Capabilities") echo " class=\"active\""; ?>><a href="#">Capabilities</a> <ul> <li><a href="#">Safety Management</a></li> <li><a href="#">Risk Management</a></li> <li><a href="#">Project Management</a></li> <li><a href="#">Business Development</a></li> <li><a href="#">Bid Support</a></li> </ul> </li> I'm just looking at a fix now so I'll let you know if I work it out! Many thanks again Vicky
April 3, 200917 yr Hi Ben Thanks so much for looking at that for me. You were right, that is why it wasn't working properly. However, having now switched it over to styling the <a> rather than the <li> means that the 'active' colour no longer works, ie: this part of the code: <li <?php if ($thisPage=="Capabilities") echo " class=\"active\""; ?>><a href="#">Capabilities</a> <ul> <li><a href="#">Safety Management</a></li> <li><a href="#">Risk Management</a></li> <li><a href="#">Project Management</a></li> <li><a href="#">Business Development</a></li> <li><a href="#">Bid Support</a></li> </ul> </li> I'm just looking at a fix now so I'll let you know if I work it out! Many thanks again Vicky Hi Vicky, You should just be able to swap the php code into the <a> tag: <li><a href="#" <?php if ($thisPage=="Capabilities") echo " class=\"active\""; ?>>Capabilities</a> <ul> <li><a href="#">Safety Management</a></li> <li><a href="#">Risk Management</a></li> <li><a href="#">Project Management</a></li> <li><a href="#">Business Development</a></li> <li><a href="#">Bid Support</a></li> </ul> </li> - Ben
April 3, 200917 yr Author So logical when you put it that way, but it would have taken me ages to come up with that! Thank you so much - that now works perfectly - you're a genius. I really appreciate your help. Many thanks Vicky
April 3, 200917 yr So logical when you put it that way, but it would have taken me ages to come up with that! Thank you so much - that now works perfectly - you're a genius. I really appreciate your help. Many thanks Vicky No problem
Create an account or sign in to comment