Interview Question

What are combinator selectors?

Combinators select elements through ancestor, child, or sibling relationships.

💡 Concept ✅ Quick Revision 🎨 CSS

Answer

Combinators describe relationships between selector subjects. • A space selects descendants and `>` selects children. • `+` selects the next sibling and `~` selects following siblings. • Combinators match document relationships, not visual positions.

💡 Simple Example

nav > a + a { margin-inline-start: 1rem; }

⚡ Quick Revision

Combinators select elements through ancestor, child, or sibling relationships.