Let's cheat the combinators
If you’re anything like me, you still have to look up some stuff from time to time, no matter how many times you’ve used it. One of those things for me is “combinators.”
A “combinator” is a special character that denotes the type of relationship between parts of a selector. And now, we have a cheat sheet!
-
space character: the descendent combinator matches a direct or nested child
-
>
: the direct child combinator matches only top-level, un-nested children -
+
: the adjacent sibling combinator matches only the very next sibling -
~
: the general sibling combinator matches one or more siblings following the base selector