Selectors Interview Questions
6 curated selectors interview questions with detailed answers and examples.
← Browse all interview questionsLearn the three-column specificity calculation, where inline styles and !important sit in the cascade, and why specificity is only one tiebreaker among several.
Both flatten selector lists identically, but :is() takes the specificity of its most specific argument while :where() is always zero.
Learn how :has() lets a parent be styled based on its descendants, replacing a whole category of JavaScript class toggling.
Three focus pseudo-classes with three different jobs, and the accessibility reason :focus-visible exists at all.
One counts every sibling, the other counts only siblings of the same element type. See exactly where they diverge and what the of S syntax adds.
One selects existing elements in a particular state, the other creates a sub-part that is not in the DOM. Learn the syntax, specificity, and limits of each.