The :link
pseudo selector styles elements before they are visited and :visited
styles them after. Is there any difference between doing:
a { border-color: red; }
and
a:link {border-color: red}
?
Yes, Definitely difference is there. If your anchor tag does not contain any href
values or only having #
then the attribute a:link
won't target the elements. Look at the snippet below, I am just using a
and it targets all the elements.
a { color:green; }
<a href="#">link having #</a>
<a>link without href</a>
<a href="test.html">Link having some value</a>
Now i will try to use a:link
, and if you look at that it will target only the element which has the href
links.
a:link { color:green; }
<a href="#">link having #</a>
<a>link without href</a>
<a href="test.html">Link having some value</a>
a:link { color:red;}this make the link color red when it is not even used; a:visited {color :green } this makes the link look green even if it is visited once ..