Pseudo-Classes

A Pseudo-class, or pseudo-selector, is used to select an element in a specific state.

Dynamic Pseudo-Classes

Commonly used with menus and hyperlinks, these include :link, :visited, :hover, :active, and :focus.

For details on these, please refer to the menu discussion from INFS 315.

UI Element State Pseudo-Classes

The element state pseudo classes are typically used with forms. The element state pseudo-classes include :enabled, :disabled, and :checked.

Structural Pseudo-Classes

These pseudo-classes are used to select elements based upon position within the DOM or document object model.

Example

The :last-of-type structural pseudo-class can be used to select the final element of an unordered list used as a menu.

.menu li:last-of-type {text-align: right;}

Other Pseudo-Classes

The :target pseudo-class is incredibly helpful in designing menus; the :lang pseudo-class should be familiar from creating HTML templates.