CSS :link Selector

CSS selector :link, is used to select link elements (<a>) that have not been visited yet. For an element <a> to be selected with the "link" selector, it must contain the "href" attribute.

A link element can receive more states (:link,:visited,:hover,:focus,:active), these states are determined by the actions created by the mouse or keyboard (especially TAB)..

This CSS tutorial explains how to use the CSS selector called :link with syntax and examples.

The :link selector is used to select unvisited links.

The CSS :link selector allows you to target links that have not been visited.

If the link has not been accessed, it has "link" state and can be selected by the ":link" selector.Elements that have been accessed before, can not be selected through the ":link".

For example, we can select all <a> elements of a html document and add a red color to the text.

Example -