[thelist] font color on links

Sarah Adams mrsanders at designshift.com
Tue May 23 12:40:24 CDT 2006


> I have some links and I am trying to give them a color when it is on that
> page, so I was using A.active, similar to if you want to hover and have it
> be a different color, however it doesnt seem to be working.
> 
> <style>
> .topnav{font: bolder 11px Verdana; padding-top: 25px;text-decoration: none}
> .topnav.A:link{color: #4D4D4D;text-decoration: none}
> .topnav.A:visited{color: #4D4D4D;text-decoration: none}
> .topnav.A:active{color: #194C88;text-decoration: none}
> .topnav.A:hover{color: #194C88;text-decoration: none}
> </style>

To do this, your CSS should be:
.topnav a:link{color: #4D4D4D;text-decoration: none}
.topnav a:visited{color: #4D4D4D;text-decoration: none}
.topnav a:hover{color: #194C88;text-decoration: none}
.topnav a:active{color: #194C88;text-decoration: none}

Note the space between ".topnav" and "a", that the "a" is lowercase, and 
that the order of ":hover" and ":active" is switched. You might want to 
check out this tutorial on CSS selectors:
http://css.maxdesign.com.au/selectutorial/

<tip type="CSS pseudo-classes">
Here's a mnemonic for remembering the correct order of link 
pseudo-classes: "love hate":

link
o
visited
e

hover
active
t
e
</tip>

-- 
sarah adams
web developer & programmer
portfolio: http://sarah.designshift.com
blog: http://hardedge.ca



More information about the thelist mailing list