I need to set the a:visited CSS to whatever color the normal a is set to.
What I want to be able to tell the browser is, for the visited links, use the same
I don't think there's a pure CSS solution. Usually you would pick a color, and set both a:link and a:visited that same color.
I tried {color: inherit} but that was useless.
This jQuery solution works great though.
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"
type="text/javascript"></script>
<script type="text/javascript">
$(function(){
var normalColor = $('a:link').css('color');
$('a:visited').css('color', normalColor);
});
</script>
</head>
<body>
<a href="http://www.google.com">Google</a>
<a href="nowhereyouvebeen">No where you've been</a>
</body>
</html>
a.one:link {
color:#996600;
background-color:transparent;
text-decoration:underline;
}
a.one:hover {
color: red;
background-color: transparent;
text-decoration: underline;
}
a.one:visited {
color: #996600;
background-color: transparent;
text-decoration: underline
}
a.one:hover {
color: red;
background-color: transparent;
text-decoration: underline;
}
I don't think there is a pure CSS way of achieving this. I think you would need to use JavaScript to get the color of the a and then set a:visited to that color and this probably wouldn't work in all browsers unless there was an a{color:#dea} specified.
Danny Robers script works for me in Firefox and Chrome (not sure about IE).
FWIW, the special value HyperlinkText would have been the "standard" way to do what you want, but it was dropped from CSS3 sometime in spring 2003.
It looks like Firefox is the only browser that started implementing it, because the following works for Firefox:
a:visited { color: -moz-hyperlinktext; }