HTML and CSS Reference
In-Depth Information
Pseudo-classes are classes of HTML elements that defi ne the condition or state of the ele-
ment in the Web page. Many pseudo-classes were introduced in CSS2.
Pseudo-Class
Matches
:canvas
The rendering canvas of the document
:first
The first printed page of the document (used only with print styles created
with the @print rule)
:last
The last printed page of the document (used only with print styles created
with the @print rule)
:left
The left side of a two-sided printout (used only with print styles created
with the @print rule)
:right
The right side of a two-sided printout (used only with print styles cre-
ated with the @print rule)
:root
The root element of the document
e
:active
The element,
e
, that is being activated by the user (usually applies only
to hyperlinks)
e
:checked
The checkbox or radio button,
e
, that has been checked (CSS3)
e
:disabled
The element,
e
, that has been disabled in the document (CSS3)
e
:empty
The element,
e
, that has no children
e
:enabled
The element,
e
, that has been enabled in the document (CSS3)
e
:first-child
The element,
e
, which is the first child of its parent element
e
:first-node
The first occurrence of the element,
e
, in the document tree
e
:first-of-type
The first element of type
e
(CSS3)
e
:focus
The element,
e
, that has received the focus of the cursor
e
:hover
The mouse pointer is hovering over the element,
e
e
:lang(
text
)
Sets the language,
text
, associated with the element,
e
e
:last-child
The element,
e
, that is the last child of its parent element (CSS3)
e
:last-of-type
The last element of type
e
(CSS3)
e
:link
The element,
e
, has not been visited yet by the user (applies only to
hyperlinks)
e
:not
Negate the selector rule for the element,
e
, applying the style to all
e
elements that do not match the selector rules
e
:nth-child(
n
)
Matches
n
th
child of the element,
e
;
n
can also be the keywords odd or
even (CSS3)
e
:nth-last-child(
n
)
Matches
n
th
child of the element,
e
, counting up from the last child;
n
can also be the keywords odd or even (CSS3)
e
:nth-of-type(
n
)
Matches
n
th
element of type
e
;
n
can also be the keywords odd or even
(CSS3)
e
:nth-last-of-type(
n
)
Matches
n
th
element of type
e
, counting up from the last child;
n
can
also be the keywords odd or even (CSS3)
e
:only-child
Matches element
e
only if it is the only child of its parent (CSS3)
e
:only-of-type
Matches element
e
only if it is the only element of its type nested within
its parent (CSS3)
e
:target
Matches an element,
e
, that's the target of the identifier in the docu-
ment's URL (CSS3)
e
:visited
The element,
e
, has been already visited by the user (to only the
hyperlinks)