Tuesday, October 25, 2011

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 %26quot;services%26quot; page, the link on the top navigation named %26quot;services%26quot; 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 %26quot;a:active%26quot; 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 %26quot;a%26quot;.How do you make a link to a page change color when you're on that page?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 %26quot;services%26quot; page will be something like this:



%26lt;a class=%26quot;services%26quot; href=%26quot;URL path to external link%26quot; title=%26quot;Mouseover Description%26quot;%26gt;Services%26lt;/a%26gt;



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



RonHow do you make a link to a page change color when you're on that page?%26lt;BODY LINK=%26quot;Blue%26quot; VLINK=%26quot;Green%26quot; ALINK=%26quot;Red%26quot;%26gt;