foundation

CSS core concepts

Cascade, specificity, inheritance, box model, stacking contexts, and containing blocks.

Core CSS interviews test whether you can debug why styles apply, how boxes size, and why layers stack unexpectedly. These fundamentals underpin every layout and architecture decision.

Subtopics: cascade resolution, specificity, inheritance, box model, stacking contexts, and containing blocks.

On interviews: walk through why a rule loses, how margin collapse surprises vertical flow, and why z-index fails without finding the stacking context.

Common pitfalls: escalating specificity, assuming all properties inherit, and huge z-index values that never escape a parent context.

Checklist:

  • Know cascade order before guessing at overrides.
  • Keep specificity intentionally low.
  • Treat box model and overflow as behavior.
  • Debug z-index by finding context boundaries.