05 · Core
CSS
Layout, the cascade, and the visual questions people underestimate.
Layout, the cascade, and making it fast. "Center a div" is a meme; "explain the stacking context" is the real interview.
Fundamentals & the cascade
| Topic | Difficulty | Time | Tags | Best Resources |
|---|---|---|---|---|
Box model & box-sizing |
🟢 | 30m | #basics #layout |
MDN: box model ⭐ |
| The cascade & specificity | 🟡 | 45m | #cascade |
web.dev: specificity ⭐ |
Inheritance & initial/inherit/unset |
🟢 | 20m | #cascade |
web.dev: inheritance ⭐ |
Cascade layers (@layer) |
🟡 | 30m | #cascade #modern |
MDN: @layer ⭐ |
| Selectors & combinators | 🟢 | 45m | #selectors |
MDN: selectors ⭐ |
| Pseudo-classes & pseudo-elements | 🟢 | 45m | #selectors |
MDN ⭐ |
:has(), :is(), :where() |
🟡 | 30m | #selectors #modern |
MDN: :has ⭐ |
| Units (rem/em/%/vw/ch) | 🟢 | 30m | #basics |
web.dev: sizing ⭐ |
Layout
| Topic | Difficulty | Time | Tags | Best Resources |
|---|---|---|---|---|
| Display & normal flow | 🟢 | 30m | #layout |
web.dev: layout ⭐ |
| Flexbox | 🟢 | 1h | #layout #flexbox |
CSS-Tricks: flexbox ⭐ |
| Grid | 🟡 | 1h | #layout #grid |
CSS-Tricks: grid ⭐ |
| Positioning (relative/absolute/sticky) | 🟡 | 45m | #layout |
MDN: position ⭐ |
| Stacking context & z-index | 🔴 | 1h | #layout #stacking |
Josh Comeau: stacking contexts ⭐ |
| Overflow & scroll containers | 🟢 | 30m | #layout |
MDN: overflow ⭐ |
| Multi-column & aspect-ratio | 🟡 | 30m | #layout #modern |
MDN: aspect-ratio ⭐ |
| Centering (all the ways) | 🟢 | 20m | #layout |
Josh Comeau ⭐ |
Responsive & modern
| Topic | Difficulty | Time | Tags | Best Resources |
|---|---|---|---|---|
| Media queries | 🟢 | 45m | #responsive |
web.dev: media queries ⭐ |
| Container queries | 🔴 | 1h | #responsive #modern |
MDN: container queries ⭐ |
Fluid type & clamp() |
🟡 | 30m | #responsive |
web.dev: fluid type ⭐ |
| Custom properties (variables) | 🟡 | 45m | #variables #theming |
MDN: custom properties ⭐ |
| Logical properties | 🟡 | 30m | #i18n #modern |
MDN: logical properties ⭐ |
Dark mode & color-scheme |
🟡 | 45m | #theming |
web.dev: color scheme ⭐ |
prefers-* (color-scheme, reduced-motion) |
🟡 | 30m | #a11y #modern |
web.dev ⭐ |
Animation & performance
| Topic | Difficulty | Time | Tags | Best Resources |
|---|---|---|---|---|
| Transitions | 🟢 | 30m | #animation |
MDN: transitions ⭐ |
| Keyframe animations | 🟡 | 1h | #animation |
MDN: animations ⭐ |
| Transforms (2D/3D) | 🟡 | 45m | #animation |
MDN: transform ⭐ |
GPU-accelerated animation & will-change |
🔴 | 45m | #animation #performance |
web.dev: animations guide ⭐ |
| Reflow vs repaint vs composite | 🔴 | 1h | #performance |
web.dev: rendering perf ⭐ |
content-visibility & containment |
🔴 | 45m | #performance #modern |
web.dev: content-visibility ⭐ |
| Scroll-driven animations | 🔴 | 45m | #animation #modern |
MDN ⭐ |
Architecture
| Topic | Difficulty | Time | Tags | Best Resources |
|---|---|---|---|---|
| CSS architecture (BEM, ITCSS) | 🟡 | 45m | #architecture |
BEM ⭐ |
| CSS-in-JS vs utility CSS (Tailwind) | 🟡 | 45m | #architecture |
patterns.dev: CSS-in-JS ⭐ |
| CSS Modules & scoping | 🟢 | 30m | #architecture |
CSS Modules ⭐ |
| Design tokens | 🟡 | 45m | #design-systems #theming |
W3C: design tokens ⭐ |
| Accessibility in CSS (focus, contrast) | 🟡 | 45m | #a11y |
web.dev: a11y ⭐ |
❓ Rapid-fire CSS interview questions
Real CSS interview questions. Answer out loud, then verify against the resources above.
- Explain the box model and
box-sizing. - How does specificity work? Calculate it for a given selector.
- Flexbox vs Grid — when do you use each?
- What is a stacking context and how does z-index really work?
position: relative vs absolute vs fixed vs sticky?- Pseudo-classes vs pseudo-elements?
emvsremvs%vsvw/vh— when to use which?- What is the cascade and how is inheritance resolved?
- Container queries vs media queries?
- What is
will-changeand how does GPU compositing help animations? - Reflow vs repaint vs composite — which properties are cheap to animate?
- How many ways can you center a div?
- What are CSS custom properties (variables)?
- What is BEM and why use a CSS methodology?
inlinevsblockvsinline-block?- Difference between
visibility: hidden,display: none, andopacity: 0? - How does
object-fitwork? - What are logical properties and why do they matter for i18n?
- How does
aspect-ratioprevent layout shift (CLS)? - Transitions vs animations — when to use each?
- How do you implement dark mode?
- What triggers a new stacking context?
- What is
content-visibilityand how does it boost performance? - What is the difference between a CSS reset and normalize?
- How does the
:has()selector work?
Related: 02-browser · 09-performance · 11-accessibility
Missing something? Add a row.