I know it's a stupid question.
I always wondered what is the difference between:
.test a {}
or
.test a:link {}
I did several tests, they look the same.
what changes?
I know it's a stupid question.
I always wondered what is the difference between:
.test a {}
or
.test a:link {}
I did several tests, they look the same.
what changes?
the :link selector is used to style the unvisited links. For example, the following would change the font-size of the unvisited links.
a:link {
font-size:14px;
}
6.6.1.1. The link pseudo-classes:
:link
and:visited
User agents commonly display unvisited links differently from previously visited ones. Selectors provides the pseudo-classes
:link
and:visited
to distinguish them:
- The
:link
pseudo-class applies to links that have not yet been visited.- The
:visited
pseudo-class applies once the link has been visited by the user.After some amount of time, user agents may choose to return a visited link to the (unvisited) ‘
:link
’ state.The two states are mutually exclusive.
Moreover, adding the :link
pseudo-class increases the specificity:
A selector's specificity is calculated as follows:
- count the number of ID selectors in the selector (=a)
- count the number of class selectors, attributes selectors, and pseudo-classes in the selector (=b)
- count the number of type selectors and pseudo-elements in the selector (=c)
- ignore the universal selector