Search code examples
cssnaming-conventionscss-selectorsnaming

What is that thing between CSS "selectors" called?


What do you call these:

body > p + p

in a CSS selector? Are they:

  • Relational operators
  • Position-based criteria
  • Something else?

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?)


Solution

  • According to https://www.w3.org/TR/selectors-3/#combinators they are called "combinators".

    1. (space character) = descendant combinator
    2. > (angle bracket or greater-than sign) = child combinator
    3. + (plus mark) = adjacent sibling combinator
    4. ~ (tilde) = general sibling combinator