Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Difference between ‘a:link’ and just ‘a’

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #23651
    Oskar
    Participant

    Hi guys,

    I’ve never really understood the magic of links and css, sometimes it just works using a:link instead of just a. How does it actually work?

    Does the a element target both a:link, a:visited, a:active and a:hover? No..

    When having to style nested menus it can get a bit messy with all the css selectors you need on a three-level-menu :)

    #51413
    Jonz
    Member

    I think its just being specific. They both do the same.

    When you use a: hover – you’re being specific to the anchor hover state
    like wise a:visited and a:active

    I would guess the actual proper way to write it (if you try to think like the W3C) would be:

    Code:
    a:link {
    color: #666;
    }
    a:visited {
    color: #030;
    }
    a:hover {
    color: #333;
    }
    a:active {
    color: #0C3;
    }
    #51414
    Jonz
    Member

    I have to start declaring link for the anchor styles. It is indeed the correct way to do it.

    #51343
    Oskar
    Participant

    Alright, thank you for clearing it up for me, Jonz.

    #51477
    iopet
    Member

    [img]http://img175.imageshack.us/img175/3417/60204461nx0.jpg[/img]

    #51706
    Oskar
    Participant

    Thanks all. I just discovered these posts by Eric Meyer. It’s definitely worth a read.
    Link Specificity, Ordering the Link States and Who Ordered the Link States?

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.