Pseudo-classes
Pseudo-classes initially provided additional styles relating to a selector??™s state, but now
also include those that apply styles to conceptual document components.
Note that the word element in the preceding table refers to a general element on the
web page, rather than a de facto HTML element.
CSS REFERENCE
491
D
Pseudo-class Description
:active The state when an element is active (e.g., when a link is being
clicked)
:first-child Affects the first descendant of an element
:focus The state when an element is focused to accept keyboard input
:hover The state when the pointer is over an element
:lang Applies to elements with the specified language (defined using
xml:lang)
:link Applies to an unvisited link
:visited Applies to a visited link
Pseudo-elements
Pseudo-elements enable generated content that??™s not in the document source and the
styling of conceptual document components.
Pseudo-element Description
:after Used in conjunction with content to generate content after an element.
For example:
h1:after {content: url(bleep.wav);}
:before Used in conjunction with content to generate content before an
element.
:first-letter Styles the first letter of an element.
:first-line Styles the first rendered line of a ???block-level??? element.
CSS boilerplates and management
By using CSS comments and a monospace font when editing CSS, it??™s possible to create
clear sections within the style sheet and a table of contents, enabling you to more easily
manage rules.
Pages:
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578