HTML and CSS Reference
Choosing elements based on user interaction
Dynamic pseudo-classes allow you to assign different styles to ele-
ments based on user activity. One of the best known of these is the
:hover pseudo-class, introduced in CSS2 , which lets you apply a differ-
ent style to an element when the mouse pointer is hovering over it (see
appendix C for some examples).
CSS3 adds several new dynamic
pseudo-classes. In this section,
you'll learn about styling form
elements based on their proper-
ties. This will let you give cues
to your users about the state of
form elements—for example,
whether they're required or
whether they're currently valid.
After that, you'll learn about the
target selector that lets you style
the page based on the current
URL , which is useful for tabbed
interfaces and slide shows.