CSS Pseudo-Classes

In CSS, pseudo-classes are basically keywords that specifies the special state of elements. A CSS pseudo-class starts with a colon (:).

The syntax to use pseudo-class in CSS, is:

selector:pseudoClass {declaration}

For example:

a:hover {color: red;}

The above CSS code, specifies that a element gets colored to red, when a mouse cursor hovers over it (link).

Note - Selector is used to select an HTML element within a web page.

List of All CSS Pseudo-Classes

CSS Online Test

« Previous Tutorial Next Tutorial »

Liked this post? Share it!