4
Pseudo-cl asses and
Pseudo-elements
The very first CSS specification, CSS1,
introduced the concepts of pseudo-classes
and pseudo-elements. These are selectors that
act on information about elements that extends
(or sits outside of) the document tree. A pseudo-class
differentiates among an element’s different states or types; these include—
but are not limited to—those that provide information about link states:
:hover, :visited, :active, and so on. A pseudo-element provides access to an
element’s subpart, which includes those pseudo-elements that select por-
tions of text nodes; for instance, :first-line and :first-letter.
The selectors just mentioned have been around since the first CSS spec-
ification, but a handful more were added in CSS2.1—although pseudo-
element support has not been well implemented until relatively recently.
CSS3 builds on these foundations with an expanded range of pseudo-classes,
as well as a (slightly) tweaked syntax to differentiate pseudo-elements.
PX
3024