What do you call these:
body > p + p
in a CSS selector? Are they:
I just have no idea what to call them. Is there an official name?
(And, also, are there official names for a b c
in a b c, d e f
and a
in a b c
?)
According to https://www.w3.org/TR/selectors-3/#combinators they are called "combinators".
(space character) = descendant combinator>
(angle bracket or greater-than sign) = child combinator+
(plus mark) = adjacent sibling combinator~
(tilde) = general sibling combinatorAs identified by Tom Haws, the operators between the simple selectors are called combinators. In CSS2 there were only three: +
, >
, and the space combinator.
>
is the combinator used in a CSS child selector.+
is the combinator used in a CSS adjacent sibling selector.In each case, the 'selector' is the full combination of the simple selectors and the combinators.
The range of valid combinators expanded, once CSS Selectors Level 3 was standardized, to include the ~
or "subsequent-sibling" combinator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With