Pseudo-classes

Pseudo-classes are selectors that use information that is outside of the document tree. The information that is not in the attributes of the element. This information can change between visits or even during the visit. Pseudo-classes always have a colon followed by the name of the pseudo-class.

The link pseudo-classes

There are two mutually exclusive link pseudo-classes, namely, :link and :visited.

:link

This selects links that have not been visited. The syntax is as follows:

:link

Description

This pseudo-class exists on any anchor element that has not been visited. The browser may decide to switch a link back after some time.

Here is an example along with the :visited pseudo-class. Here is its HTML:

<a href="#test">Probably not visited</a> ...

Get Web Developer's Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.