How do I highlight a link based on the current page?

It really depends on how your page is constructed. Typically, I would do this using CSS, and assign give the link an id called "active"...

<a id="active" href="thisPage.html">this page</a>

...and in the CSS...

a#active { color: yellow; }

Obviously this is a fairly simplistic example, but it illustrates the general idea.


It's a server-side thing -- when rendering the page, add a class like "current-page" to the link. Then you can style it separately from the other links.

For example, StackOverflow renders the links with class="youarehere" when it points to the page you're already on.