Coding links (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


paulie -> Coding links (6/12/2003 14:45:39)

I have link attributes defined in my css thusly:

A:link {text-decoration: none; color: orange;}
A:hover {text-decoration: none; color: white;}
A:visited {text-decoration: none; color: orange;}

I notice that once a page has been visited, the hover attribute no longer functions, which seems logical given the rather limited options in the code. Is there a way to change that so the link always displays the hover color when moused over?
I know this can be done with Javascript menus, but I rather like the simplicity of CSS for this purpose.




bobby -> RE: Coding links (6/12/2003 17:12:11)

They' re in the wrong order... should be (if I remember correctly)

Link
Visited
Active
Hover

Put them in this order and it should work [;)]




paulie -> RE: Coding links (6/12/2003 17:54:31)

Bobby, a thousand thank-you' s. You must not have had too many djinn & tunics, because you remembered the sequence correctly. [:)]I didn' t realize they needed to be in a specific order, and I was absent the Active one.
It' s working beautifully now, and I can go fix two other websites with the same problem! [sm=rolleyes.gif]




pageoneresults -> RE: Coding links (6/12/2003 18:58:15)

The correct order should be...

LVHA

a:link
a:visited
a:hover
a:active

If the a:active becomes before a:hover, the a:active rule will not work. Also, you could trim your above example to this...

a{text-decoration:none;}
a:link, a:visited{color:orange;background:none;}
a:hover{color:white;background:none;}
a:active{color:red;background:none;} (or whatever combination you are using)

Anytime you specify a color, there should also be a background color whether it is an actual color, none, or transparent, you' ll need it to validate your CSS 100%. Also, adding a background color adds a little bit of flavor to your link text. ;)

P.S. Everyone should start getting into the habit of using all lower case in their stylesheets and their html coding.




paulie -> RE: Coding links (6/12/2003 20:17:10)

Thanks. They seemed to be working fine in that order, but I' ll heed your advice nonetheless. Just curious about the case issue, is that due to browser compatibility, or just good coding standards?




Gil -> RE: Coding links (6/12/2003 21:29:29)

quote:

Just curious about the case issue, is that due to browser compatibility, or just good coding standards?


All programming was case sensitive until MS decided to destroy any semblance of logic. It’s 1. good coding standards and 2. as we all move to xml it will be required.




bobby -> RE: Coding links (6/13/2003 11:16:54)

quote:

The correct order should be...


Thanks for the correction POR!

[:)]




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.09375