📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials CSS Mastery CSS Interview Prep

CSS Interview Prep

5 min read Quiz at the end
CSS interview essentials: specificity order (inline > ID > class > element), what creates stacking contexts, Flexbox vs Grid differences, rem vs em, box-sizing: border-box, and which properties trigger layout vs paint.

CSS Interview Essentials

  • Specificity order — inline > ID > class > element
  • !important — overrides specificity (use sparingly)
  • Cascade — importance, specificity, order
  • Stacking context — created by opacity, transform, z-index
  • Flexbox vs Grid — flex = 1D; grid = 2D
  • rem vs em — rem = root; em = parent
  • Repaint vs Reflow — colour = repaint; layout = reflow (costly)
Topic Quiz · 5 questions

Test your understanding before moving on

1. CSS specificity order (lowest to highest)?
💡 Specificity: element (0,0,0,1) < class (0,0,1,0) < id (0,1,0,0) < inline (1,0,0,0).
2. What does !important do?
💡 !important overrides normal specificity rules — use sparingly.
3. Flexbox vs Grid?
💡 Flexbox handles one dimension (row OR column); Grid handles both dimensions simultaneously.
4. What is a stacking context?
💡 A stacking context is an isolated z-index layer. Elements inside can't escape it.
5. Repaint vs Reflow?
💡 Reflow (layout) is expensive — avoid triggering it in animations. Use transform/opacity instead.