Combinators express relationships between selectors: descendants, children, adjacent siblings, and general siblings.
Combinator cheatsheet
A BdescendantA > Bdirect childA + Badjacent siblingA ~ Bgeneral sibling
Pitfall
Deep descendant chains couple CSS to fragile markup structure and increase regression risk.
Important interview questions and answers
- Q: Child combinator vs descendant?
A: Child requires direct parent-child; descendant allows any depth. - Q: Why avoid over-nested combinators?
A: Harder maintenance and brittle behavior under markup changes. - Q: Useful practical combinator?
A:li + lifor spacing between siblings without first-item special case.
Pitfall: Check cascade order—author stylesheet loses to inline styles and !important surprises.