Need to highlight menu item when page is active

I am using php to include a menu on my individual pages which is a common practice. What I'd like to do is highlight the menu item when the corresponding page is active. I've tried a few methods but have been unsuccessful.

Any help is appreciated.
J CAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
COBOLdinosaurConnect With a Mentor Commented:
Just give each of the menu tabs a unique id, and then generate a style tag in the head with a single rule for the target id and the highlighting you want:
<style type="text/css">
#idnumber1 {background-color:magenta;}
</style>

Cd&
0
 
käµfm³d 👽Commented:
When a page is active, give the menu item that represents that page a different CSS class. Simply have two CSS rules in your stylesheet:  one for inactive tabs and the other for the active tabs. Just toggle between the classes as the pages change.
0
 
J CAuthor Commented:
Thanks, that works.
0
All Courses

From novice to tech pro — start learning today.