Summary
The :link CSS pseudo-class lets you select links inside elements. This will select any link which has not yet been visited, even those already styled using selector with other link-related pseudo-classes like :hover, :active or :visited. In order to appropriately style links, you need to put the :link rule before the other ones, as defined by the LVHA-order: :link — :visited — :hover — :active. The :focus pseudo-class is usually placed right before or right after :hover, depending on the expected effect.
Examples
a:link {color: slategray;}
.external:link {background-color: lightblue;}
Specifications
| Specification | Status | Comment |
|---|---|---|
| WHATWG HTML Living Standard The definition of ':link' in that specification. |
Living Standard | |
| Selectors Level 4 The definition of ':link' in that specification. |
Working Draft | No change. |
| Selectors Level 3 The definition of ':link' in that specification. |
Recommendation | No change. |
| CSS Level 2 (Revision 1) The definition of ':link' in that specification. |
Recommendation | Lift the restriction to only apply it for <a> element. |
| CSS Level 1 The definition of ':link' in that specification. |
Recommendation | Initial definition. |
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | 1 | 1.0 (1.7 or earlier) | 3.0 | 3.5 | 1.0 |
| Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Basic support | 1.5 | 1.0 (1.9.2) | ? | ? | 3.2 |