Anchor link color problem

liunx

Guest
I've used this style for my links<br />
<br />
<style type="text/css"><br />
A { font-weight: normal;}<br />
A:link {text-decoration: none; color: #285169;}<br />
A:visited {text-decoration: none; color: #666666;}<br />
A:active {text-decoration: none; color: #285169;}<br />
A:hover {text-decoration: none; color: #FFFFFF;}<br />
</style><br />
<br />
All the links work fine on hover etc. etc.<br />
<br />
But when I do anchor links like this<br />
<br />
<A HREF=http://www.htmlforums.com/archive/index.php/"#why">Why should I register?</A><br />
<br />
The link automatically sets itself to the visited color instead of the default link color, I can't figure out why.<br />
<br />
If I clear my history then the colors are fine but as soon as I refresh they set themselves as the visited color.<br />
<br />
Any suggestions?<!--content-->that's because you're on the HTML document it's pointing to, even if you're not at the designated position.<br />
<br />
set up a class just for anchors. and you can use a span tag if necessary.<!--content-->p.s.,<br />
<br />
this is done using<br />
<br />
.class a:visited {style:style;}<br />
<br />
and<br />
<br />
<a href=http://www.htmlforums.com/archive/index.php/"#why" class="class"></a><br />
<br />
so, if you have a bunch of local anchors, you could also use<br />
<br />
<span class="class"><br />
<a href=http://www.htmlforums.com/archive/index.php/"#why">Why should I register?</a><br />
<a href=http://www.htmlforums.com/archive/index.php/"#who">Who should I register?</a><br />
<a href=http://www.htmlforums.com/archive/index.php/"#what">What should I register?</a><br />
<a href=http://www.htmlforums.com/archive/index.php/"#when">When should I register?</a><br />
<a href=http://www.htmlforums.com/archive/index.php/"#how">How should I register?</a><br />
</span><!--content-->Thanks, I really appreciate your help. But I'm still kinda lost, I'm fairly new to html and css. How would I add it? In the same style tag for the links or should I create a new style?<!--content-->sure...<br />
<br />
<style type="text/css"> <br />
A { font-weight: normal;} <br />
A:link {text-decoration: none; color: #285169;} <br />
A:visited {text-decoration: none; color: #666666;} <br />
A:active {text-decoration: none; color: #285169;} <br />
A:hover {text-decoration: none; color: #FFFFFF;} <br />
.anchor a:visited {text-decoration: none; color: #285169;}<br />
</style><br />
<br />
in the head, and then<br />
<br />
<span class="anchor"> <br />
<a href=http://www.htmlforums.com/archive/index.php/"#why">Why should I register?</a> <br />
<a href=http://www.htmlforums.com/archive/index.php/"#who">Who should I register?</a> <br />
<a href=http://www.htmlforums.com/archive/index.php/"#what">What should I register?</a> <br />
<a href=http://www.htmlforums.com/archive/index.php/"#when">When should I register?</a> <br />
<a href=http://www.htmlforums.com/archive/index.php/"#how">How should I register?</a> <br />
</span><br />
<br />
in the body.<!--content-->Thanks, that worked but now it seems that the hover version is disabled for those particular links.<!--content-->sure, you can go ahead and do a hover pseudoclass for the anchor class. just do the exact same thing, only use your hover CSS with a class. that's all you need to do. you can do all the other pseudoclasses too, if you want.<!--content-->Trans thank you very much man, you solved my problem.<br />
<br />
Please look for more of my questions soon.<!--content-->
 
Back
Top