[CSS Selector] E:link
Using selector:link, you can apply styles to elements that have a link destination. Since it applies to elements with a link target, it is mainly used with the a element. This is commonly called a "pseudo-class" (the :link pseudo-class).
Be aware that this rule can be overridden by other pseudo-classes, so the order of declarations matters. Writing them in the order ':link', ':visited', ':hover', ':active' (the "LVHA" order) prevents conflicts.
Sample Code
a:link { color: red;} /* If you want to differentiate unvisited and visited link styles, always write ':link' before ':visited'. */
a:visited { color: orange;}
In practice, you can think of this as applying to any a element that has an 'href' attribute.
Browser Display Result
※ To test the sample below, please clear your browser's browsing history first.
a:link { color: red;} /* Makes the text of a elements with a link destination red. */
<p><a target="_blank" href="https://www.google.co.jp/">Goes to Google's page.</a></p> <p><a>This is an a element with no 'href' attribute, so it does not turn red.</a></p>
Browser Compatibility
8 ○
7 ○
6 ○
2 and earlier ×
2 and earlier ×
Android Browser
1.5+ ○※ Version data is based on MDN.
If you find any errors or copyright issues, please contact us.