Pseudo-Class Usage: link

1

I'm using the Pseudo Class for links, I understand the concept and usage of a:hover a:active and a:visited , but I can not understand a:link . What is the use of it? If possible I would like a practical example of this class.

    
asked by anonymous 26.08.2018 / 15:31

1 answer

0

"pseudo-class CSS :link allows you to select the links within an element. It selects all links, even those that have not been visited, including links already styled in id or :hover For proper operation it is essential that it comes before the rules: :active - :visited - :visited :hover is a pseudo-class usually used before% w / o% or later, depending on the expected result. " Source: link

In short In most browsers the default link color is blue. To change this you can use :active This is the pseudo-class to customize the default link, unvisited link, and this pseudo-class should come before all other pseudo-classes related to the link.

Examples:

/* cor do link não visitado */
a:link {
    color: red;
}

/* cor do link visitado */
a:visited {
    color: green;
}

/* cor do mouse over no link */
a:hover {
    color: hotpink;
}

/* cor do link quando ativo */
a:active {
    color: blue;
}
<a href="default.asp" target="_blank">Meu link</a>
<p><b>Nota1:</b> a:hover precisa vir antes de a:link e a:visited no CSS para funcionar.</p>
<p><b>Nota2:</b> a:active precisa vir depois a:hover no CSS definition para funcionar.</p>

OBS: These are W3C recommendations

:link { color: #0000EE; }                          /* cor azul padrão */
:visited { color: #551A8B; }                       /* cor roxa visitado */
:link:active, :visited:active { color: #FF0000; }  /* cor vermelha ativo */
:link, :visited { text-decoration: underline; cursor: pointer; }
a:link[rel~=help], a:visited[rel~=help],
area:link[rel~=help], area:visited[rel~=help] { cursor: help; }

Source: link

    
26.08.2018 / 16:05