link etiquette

liunx

Guest
a:link {color:#788282;text-decoration:none;}
a:visited {color:#788282;text-decoration:none;}
a:hover {color:#aaaaaa;text-decoration:none;}
a:active {color:#788282;text-decoration:none;}
a.headerlnk:link {color:#000000;text-decoration:none;}
a.headerlnk:visited {color:#000000;text-decoration:none;}
a.headerlnk:hover {color:#788282;text-decoration:none;}
a.headerlnk:active {color:#000000;text-decoration:none;}

I want to keep the header links for my menu a a different color from the links in the body of the menu and the body of the page. I know I can apply a separate link color for a containing element, but each header link is in a different div and the div that contains them all will contain menu links too... I figured using a class would be the easiest way to do this. Apon searching this forum I found other ways to switch link color, I was wondering if doing it this way was good etiquette.The only "etiquette" issue I see *possibly* being raised by someone would be the disabling of the visited indication.That would therefore mean anyone who used an image navigation system would be tarred with the same brush.

Apart from the CSS bloat but that's probably due to M$ Explorer screwing up again (M$ IE doesn't support :hover for a elements, which haven't got href specified.)

I don't find anything wrong a:link:hover, and a:visited:hover as it's a fairly normal soloution.Perhaps easier, however, would be something like this:

<style type="text/css">
a { color: #900; }
a:hover { color: #f00; }
#nav a { color: #006; }
#nav a:hover { color: #00f; }
</style>

Using that, you don't have to add classes to all your links.Links? One demerit point, anchors is what you meant to say. :DLol... I guess, if you want to get that technical about it. ;)Yes, you know I was pulling your legs ;)Originally posted by pyro
Perhaps easier, however, would be something like this:

<style type="text/css">
a { color: #900; }
a:hover { color: #f00; }
#nav a { color: #006; }
#nav a:hover { color: #00f; }
</style>

Using that, you don't have to add classes to all your links. well the problem is I would be making all of the links in the container that color too then, since I have a few links within these divs. I am assumeing css does inheritance so the links in this div and the div within the div would all be affected... it justs seems logical. It would be less code to put the header links in this class if the other ones have the body style instead of giving the main div a separate link color and then the div within another link color... thats why I though about giving the links a class. I was just wondering if this is a proper way to do things, thats all.Peo, if you have a div inside of the #nav div, you should be able to refer to its child links as #nav #childDiv a { ... }

I could be wrong, but I believe it will work.

[J]onaThat would still be more work since I would have to specify the ones in the nav divs to be this color and the headers. I figured a class would be easier I would only have to specify it on the header links.
 
Back
Top