CSS: Selector Classification

By Xah Lee. Date: .

Basic Selector

Type Selector

Match by tag name. Start with the tag name.

Universal Selector

The asterisk * that match all tag names.

Attribute Selector

match by attribute or its value.

includes:

  • Class Selector
  • ID Selector

Pseudo-Class Selector

Pseudo-Element Selector

Compound Selector

A combined expression with type selector, attribute selector.

Simple Selector

any that does not involve a combinator.

Complex Selector

any that uses combinator.

involving syntax of

Relative Selector

:has()

Nesting Selector

syntax &, nested inside body of css block.

Selector List

,

Forgiving Selector List