Engrain by ByteRush

WEB.08.02 Mid-level

Cascade layers and scoping

Comes up in: Web fundamentals, Frontend system design

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • @layer ordering
  • layering resets/third-party/components/utilities
  • @scope (fact: support)
  • CSS Modules and CSS-in-JS trade-offs (runtime cost, RSC compatibility)
  • BEM

Words you will know

@layer@scopeCSS ModulesCSS-in-JS

What you will practise

  • layer a stylesheet with a third-party library

Interview questions this answers

  • How does the browser decide which CSS rule wins?
  • CSS-in-JS vs CSS Modules vs utility CSS: what are the trade-offs?