Log in

View Full Version : Link Color



Dimi
06-27-2005, 09:47 PM
Sounds easier that it is...or is it. I need to be able to set the color of the link to "black" when the link is clicked and the new page loads.
I am using php and I require the top template file which has all the link in white. Is there any way I can change the color of the current link on the page that it leads to. A little confusing I know...

Thanx

mwinter
06-28-2005, 09:50 PM
I need to be able to set the color of the link to "black" when the link is clicked and the new page loads.
I am using php and I require the top template file which has all the link in white. Is there any way I can change the color of the current link on the page that it leads to. A little confusing I know...Yes, I don't think you phrased that too well. Are you saying that you have on, for example:

  http://www.example.com/foo.html

a link that points to that same address, so you want to distinguish it from all of the other links?

If that's the case, then first of all, you shouldn't have links that lead to the same page (unless they're links to anchors within a document). Still, whether you change that or not, you'll still want to change the colour of the text. The simple solution is to give the element that contains the text an id attribute (current-section, for example), then style that element with CSS:


a:link {
background-color: ...;
color: white;
}
#current-section {
background-color: ...;
color: black;
}
<ul>
<li><a href="/">Home</a></li>
<li id="current-section">Cheese</li>
<li><a href="/biscuits/">Biscuits</li>
</ul>Hopefully you get the idea. If not, please provide a link to the page in question and try to be more careful about describing the problem.

Mike