Results 1 to 6 of 6

Thread: Links Not Wokring Using CSS

  1. #1
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Links Not Wokring Using CSS

    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...
    Code:
    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;
    }

  2. #2
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Code:
    a.subitems:visited {
    	color: #666666;
    	text-decoration: none;
    }
    You don't need that part.

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by tomyknoker
    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.

    Code:
    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.


    Quote Originally Posted by blm126
    Code:
    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

  4. #4
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Yes, but if he doesn't want the link to change when visited why should it be included?

  5. #5
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by blm126
    ... 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

  6. #6
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    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?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •