Forums

This topic is locked

CSS & hover for visited links

Posted 06 Oct 2003 18:07:43
1
has voted
06 Oct 2003 18:07:43 Baron Ruhstoff posted:
Hey folks! I suspect that the problem I am having has a simple solution, but I am unable to find it...

When using CSS to format links, I am able to get the active, hover, and inactive states to look and respond visually as intended (e.g. change color and weight upon hover). However, things get screwy when it comes to visited links: the appearance is fine, but the link no longer responds to hover (e.g. no color change, no weight change).

Advice? Suggestions?
Thanks in advance!

Replies

Replied 07 Oct 2003 09:51:12
07 Oct 2003 09:51:12 Wayne Hultum replied:
Could you post your code so we can take a look?
Replied 09 Oct 2003 15:29:13
09 Oct 2003 15:29:13 Alexandra de Rosso replied:
Got this problem once, solved like this:

a {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #CFC890;
text-decoration: none;
}
a:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #CFC890;
text-decoration: underline;
}

Notice that I have defined the "a" thing for normal state and hover, but did NOT defined how the active and visited look like.

I think the browser assumes that the visited state should look like the "a" (normal one), then it... works.

check the www.phd-sc.com.br/sitenovo site I did using this. CLick in a link then get back to home, you'll see the link doens't get funny.

<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Alexandra de Rosso
Macromedia Certified Professional

www.proway.com.br
Replied 12 Oct 2003 06:15:25
12 Oct 2003 06:15:25 Diane Vigil replied:
Did you ensure that the hover declaration came after the others?

DianeV. Web Design Studio - Los Angeles
Replied 15 Oct 2003 13:14:42
15 Oct 2003 13:14:42 Janusz Jasinski replied:
www.w3schools.com/css/css_pseudo_classes.asp explains a bit about it and here is some rough code:

<pre id=code><font face=courier size=2 id=code>&lt;html&gt;
&lt;head&gt;

&lt;style type="text/css"&gt;
a:link {color: #FF0000}
a:visited {color: #00FF00}
a:hover {color: #FF00FF}
a:active {color: #0000FF}
&lt;/style&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;p&gt;&lt;b&gt;&lt;a href="default.asp" target="_blank"&gt;This is a link&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!!&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; a:active MUST come after a:hover in the CSS definition in order to be effective!!&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt; </font id=code></pre id=code>

======================
janusz.monkey-it.co.uk

Reply to this topic