Log in

View Full Version : Links Not Wokring Using CSS



tomyknoker
09-22-2006, 04:06 AM
I have a link set up that has no underline, until the user rolls over it... The only issue I'm haiving is that once they click the links and it's been visited the underline dissappears, so when they roll over it again nothing comes up. I want it so no matter wether they have visited the link or not when they roll over it it gets underlined...
a.subitems:link {
text-decoration: none;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
font-weight: normal;
color: #666666;
font-style: normal;
text-align: left;
border-top-style: none;
}
a.subitems:hover {
text-decoration: underline;
}
a.subitems:visited {
color: #666666;
text-decoration: none;
}

blm126
09-22-2006, 11:17 AM
a.subitems:visited {
color: #666666;
text-decoration: none;
}

You don't need that part.

mwinter
09-22-2006, 11:35 AM
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;

Don't use pixels to set text size: MSIE won't resize text with px or pt sizes (a bad thing). Moreover, a size of 9px is far too small. You might find it readable with Verdana, but others won't. Also, have you checked how it looks when using one of the fallback fonts? It's an unreadable mess here, and it would be worse at higher resolutions (on some laptops, for example).

Use percentages. Copy (text content) should be 100% of the default value. If you find Verdana too large, don't use it; do not make the font size smaller as Verdana has different characteristics.



color: #666666;

Colour declarations should be paired with an appropriate background colour. Do not rely on defaults as other platforms may be configured differently to your own.





a.subitems:hover {
text-decoration: underline;
}
a.subitems:visited {
color: #666666;
text-decoration: none;
}

These two rules have the same specificity: one element name, one class name, and one pseudo-class, each. Therefore, precedence comes down to order. As the visited rule is the latter, it overrides the former. Switch them around.






a.subitems:visited {
color: #666666;
text-decoration: none;
}

You don't need that part.

Actually, he does, though it should be edited: visited links should be styled differently than unvisited ones. It is rare that they should be the same colour.

Mike

blm126
09-22-2006, 08:39 PM
Yes, but if he doesn't want the link to change when visited why should it be included?

mwinter
09-23-2006, 12:16 AM
... if he doesn't want the link to change when visited why should it be included?

If it isn't the default colour will be used instead, which might be a very bad thing.

Once a style sheet sets one colour, all other colours must be set explicitly. Failing to do so and relying on assumed (but possibly incorrect) defaults may make content unreadable.

Mike

blm126
09-23-2006, 02:24 AM
No, I mean the :hover :visited thing. If you don't want a :visted link to be different than the regular link defined by the css why bother?