tags:

views:

18

answers:

4

My problem is with my navigation links. I've created a class for the links so that the link color is different from the typical links throughout. The problem is that the color defined in a:visited is taking precedence over the color defined in a:link.

I've tried everything and can't work this out. Any suggestions?

A: 

It would help if we could see the css and html in question, however, it sounds like your problem is that you have already visited the linked page and it is displaying that fact. It sounds like you want the links to be the non visited color all the time. If so you can set the :visited style to that color, but you will need to combine this with the class selector so it only effects the links contained in that class. Something like this:

.class a:visited{ color: red; }

Steve Robillard
A: 

:visited will never take precedence over :link since :link means an unvisited link. The two are mutually exclusive.

If you want to define a style that applies to a link in both states you need to either be explicit:

a.foo:link, a.foo:visited {}

Or to define:

a.foo {}

without having a matching selector with :visited in it.

(Note: "matching" meaning "matching the element" not "matching the other selector".)

David Dorward
<div id="navigation"><ul class="primary-links"><li class="nav"><a href="index.html" title="home page" id="homepagelink">home</a></li></ul></div>CSS CODE that I used:.nav a:link { color:#d4e49c; text-decoration:none;}.nav a:hover { color:#0C0;}.nav a:visited { text-decoration:none; color:#F00;}I'm new to all of this, so excuse my lack of knowledge!
Carmel
A: 
Carmel
Please delete this "answer" and edit the original question to add the extra information. Please also make use of the "code" button to add formatting.
David Dorward
A: 
Carmel