Forum Moderators: not2easy

Message Too Old, No Replies

link styles don't work

         

gulliver

10:55 am on Apr 22, 2004 (gmt 0)

10+ Year Member



In tidying my css I removed class="navlink" from my links, and instead defined <div class="nav">.

Now the visited links don't pick up the specified styles and instead are the browser default.

I can't see why.

Help appreciated. Please and thanks.

Here's sample CSS/HTML code (I even put it in the head so's to reduce caching issues).

<pre>

<html>
<head>
<title>link test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
<!--
.nav a:link {
text-decoration: none;
color: #999;
}
.nav a:visted {
text-decoration: none;
color: #999;
}
.nav a:hover {
text-decoration: underline;
color: #000;
}
.nav a:active {
text-decoration: underline;
color: #c00;
}
--></style>
</head>
<body>

<div class="nav">
<p><a href="http://www.google.com/">one</a></p>
<p><a href="http://www.google.com/">two</a></p>
<p><a href="http://www.google.com/">three</a></p>
</body>
</html>

</pre>

DanA

12:06 pm on Apr 22, 2004 (gmt 0)

10+ Year Member



What happens if you remove <p> and </p>s?
Is there a definition for links in <p>s in your style sheet?

Bonusbana

12:42 pm on Apr 22, 2004 (gmt 0)

10+ Year Member



Change
.nav a:visted

into

.nav a:visited

Fatal spelling error...

gulliver

12:54 pm on Apr 22, 2004 (gmt 0)

10+ Year Member



>What happens if you remove <p> and </p>s?
Is there a definition for links in <p>s in your style sheet?

It hadn't previously made any difference.

>Fatal spelling error...

Light bulb now alight!
Thanks - I'd looked at it so much that'd likely never have been spotted. Duh - me!

Bonusbana

1:16 pm on Apr 22, 2004 (gmt 0)

10+ Year Member



Try validating [jigsaw.w3.org] your CSS next time youre stuck, it is really easy to go word-blind when staring at the code for too long.

gulliver

1:45 pm on Apr 22, 2004 (gmt 0)

10+ Year Member



>Try validating your CSS next time youre stuck, it is really easy to go word-blind when staring at the code for too long.

Thanks. That's really good advice - and something which, in my 'what the **** is wrong - this is driving me nuts?' I completely forgot to do.

Another lesson learned.

Thanks again.

;-)