4) Pseudo-class Selectors

Let us look at the other ways to select element. When an element is nested inside another element, it becomes its descendant or child. The descendant element can be used for any nested element.

If we want to select the link between p tags only we will write :

Grouping Multiple selectors:

You can also select multiple elements by grouping them in one declaration like:

This will apply the same CSS to all elements in the list. Each selector is separated an with a comma.

Pseudo-Class Selector:

This is to target specific state of an element.
Syntax for pseudo-classes

Example: Anchor pseudo-classes

Note:
a: visited must come before a: hover in the CSS definition.
a: active must come after a: hover in CSS definition.