How do you make a link to a page change color when you're on that page?

How do you make a link to a page change color when you're on that page? For instance, if I'm on the "services" page, the link on the top navigation named "services" should have a different color from the rest. I'm using php includes for the top navigation so all pages only share one top navigation.

I tried using "a:active" but it only changes color upon clicking it. When I'm on the page, the color of the link returns to the default color for "a".

2 Answers

Relevance
  • Anonymous
    1 decade ago
    Favorite Answer

    Each page's link will have to have its own id for the link. You can include it on the CSS external file or use the embedded CSS method.

    a.services:link {

    color:#fff;

    background: #000;

    }

    Then the link on the "services" page will be something like this:

    <a class="services" href="URL path to external link" title="Mouseover Description">Services</a>

    Using pseudo-links, you can set all the link conditions for every page if you want.

    Ron

  • Win
    Lv 5
    1 decade ago

    <BODY LINK="Blue" VLINK="Green" ALINK="Red">

Still have questions? Get your answers by asking now.