Is there really any difference between selector a:link and a?

Discussion in 'CSS' started by yangyang, Apr 8, 2008.

  1. #1
    Never know any but some designers tend to use a:link while others like to use just a.

    Is there any substantial difference between them?
     
    yangyang, Apr 8, 2008 IP
  2. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #2
    YES.

    a means all links. Any properties you stick on a, assuming you don't have any other previous conflicting values, will be inherited by all the other a's: a:hover, a:link, a:focus, a:active, a:visited, unless those have values overriding a.

    a:link will not bring any inherited values to a:hover, active, etc...

    a {
    text-decoration: none;
    }

    Now all a's will have no text decoration until you override:
    a:hover {
    text-decoration: underline;
    }

    Meanwhile, if all you ever had was a:link {text-decoration: none;} then as soon as that link is clicked, hovered over, or was visited, the underline (a browser default) comes back.
     
    Stomme poes, Apr 8, 2008 IP