Menus - Active Page CSS Classes

The :active option in CSS is actually for an active link on the "calling" page, not the destination.. stupid, but true...

Heres a quick way to determine and change the class of current page.... it only works if the current url matches the menus url...

for (i=0;i<linkcount;i++) {
  if (document.links[i].href == document.URL) 
     document.links[i].className = 'menu-active';

and in your CSS you would need to have something like, { color: black; }


Index Previous Next