-
A CSS
pseudo-classis a keyword added to a selector that specifies a special state of the selected element(s) -
For example, the pseudo-class
:hovercan be used to select a button when a user's pointer hovers over the button and this selected button can then be styled -
A
pseudo-classconsists of a colon (:) followed by thepseudo-classname (e.g.,:hover) -
A functional
pseudo-classalso contains a pair of parentheses to define the arguments (e.g.,:dir()) -
The element that a
pseudo-classis attached to is defined as an anchor element (e.g.,buttonin casebutton:hover) -
Pseudo-classeslet you apply a style to an element not only in relation to the content of the document tree, but also in relation to external factors like-
the history of the navigator (
:visited, for example), -
the status of its content (like
:checkedon certain form elements) -
or the position of the mouse (like
:hover, which lets you know if the mouse is over an element or not)
-
the history of the navigator (