CSS: selector list (,)
Selector List
s1, s2, etc-
Match any s1, s2, etc.
s can be simple selector, compound selector or complex selector.
/* make red of all div of class x, or any span: */ div.x, span { color: red; } /* same as */ div.x { color: red; } span { color: red; }
Syntactic grouped Selector List
you can also use
:is()
and
:where().
they are similar.
CSS. Selectors
Selector types
Simple selectors
- CSS: type selector (tag name)
- CSS: universal selector (* any tag)
- CSS: class selector (.x)
- CSS: ID selector (#)
- CSS: attribute selector ([x])
Combinators
- CSS: descendant selector (space)
- CSS: child selector (>)
- CSS: adjacent sibling selector (+)
- CSS: subsequent sibling selector (~)
Selector list
Nesting syntax
Special selector
- CSS: :root selector
- CSS: no child selector
- CSS: first child, last child, only child selectors
- CSS: nth-child selector
- CSS: nth-child arg of selector
- CSS: nth-of-type selector
- CSS: pseudo-class selector (:)
- CSS: pseudo-element selector (::)
- CSS: negation selector (:not)
- CSS: :has descendant selector