www.webdeveloper.com
Results 1 to 7 of 7

Thread: Problem with links...

  1. #1
    Join Date
    Feb 2003
    Location
    Aberdeen, Washington, USA
    Posts
    1,859

    Problem with links...

    Does anybody know why the following code would not work.
    Code:
    a:link, a:active, a:visited {
        text-decoration: none;
    }
    
    a:hover {
        text-decoration: underline;
    }
    It works fine until I visit a link. Then when I go back to the page and hover over the link again the underline won't show up. This is happening in all browsers I tested it in.

  2. #2
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    There might be some issues with links. If I have this straight, the method used to define link pseudoclasses is to define them in this order so that they work right:

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

    I think that's how it goes. But a different order can cause issues in some browsers, for one reason or another. This may/may not be the cause.

  3. #3
    Join Date
    Aug 2004
    Location
    US
    Posts
    544
    Originally posted by MstrBob
    There might be some issues with links. If I have this straight, the method used to define link pseudoclasses is to define them in this order so that they work right:

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

    I think that's how it goes. But a different order can cause issues in some browsers, for one reason or another. This may/may not be the cause.
    probably is, its also listed in w3c that it has to be in the order i believe

  4. #4
    Join Date
    Feb 2003
    Location
    Aberdeen, Washington, USA
    Posts
    1,859
    Ok, so if I understand you correctly my code should be like this:
    Code:
    a:link { text-decoration: none; }
    a:visited { text-decoration: none; }
    a:hover { text-decoration: underline; }
    a:active { text-decoration: none; }
    But I tried that and it doesn't fix the problem.

  5. #5
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    Yes, it should. You can list them with commas, but, I believe, they must be in that order. On your personal website, you have this:

    Code:
    a:link, a:active, a:visited { color: #069; text-decoration: none; }
    
    a:hover { color: #036; text-decoration: underline; }
    And it works just fine. Also, I tend to find that active links are like hover links. Therefore, I group it with the hover styles. So:

    Code:
    a:link, a:visited { color: #069; text-decoration: none; }
    
    a:hover, a:active { color: #036; text-decoration: underline; }
    Should work.

  6. #6
    Join Date
    Feb 2003
    Location
    Aberdeen, Washington, USA
    Posts
    1,859
    Ok, thanks!

    P.S. I found out what was wrong. I'm so stupid. It had nothing to do with the links. It was somewhere later in the CSS file where I accidentally had something like this:
    Code:
    .class a:link, a:active, a:visited {
            //stuff here
    }
    But it should have been this:
    Code:
    .class a:link, .class a:active, .class a:visited {
            //stuff here
    }
    I feel so stupid now.

  7. #7
    Join Date
    Aug 2004
    Location
    US
    Posts
    544
    Originally posted by Jick
    I feel so stupid now.
    lol, it happens

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles