Sign in to track progress, unlock prep layers, and browse your pipeline.Sign in
Explain CSS specificity and selector precedence
Question
Explain CSS specificity and how the browser decides which style rule wins when multiple selectors match the same element.
Include:
- How specificity is calculated (e.g., tag vs class vs id)
- How pseudo-classes like
:hoveraffect specificity - What happens when specificity ties
- Where
!importantand inline styles fit in
AI interview prep
Core dilemma
Balancing the declarative nature of CSS with the need for deterministic style application in the face of complex and potentially conflicting rules.
Mid-level signals3
Senior signals4
Red flags4
3 tradeoffs and 2 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Explain CSS specificity and selector precedence
Question
Explain CSS specificity and how the browser decides which style rule wins when multiple selectors match the same element.
Include:
- How specificity is calculated (e.g., tag vs class vs id)
- How pseudo-classes like
:hoveraffect specificity - What happens when specificity ties
- Where
!importantand inline styles fit in