CSS
Layout with flexbox and grid, the cascade, specificity and responsive design.
29 lessons 65 practice questions about 2 hours of reading
Chapter 1, beginner
Foundations
What it is and how it works, the questions every round starts with.
- 01CSS transitions vs animations: what is the difference?
Lesson, 4 min read, then 5 questions to practise
- Make a modal animation run at 60 fps: layout, paint and composite, will-change and reduced motion
- Build an accessible CSS loading spinner with a hidden label and a reduced-motion rule
- Animate list-to-detail with the View Transitions API: unique names, a fallback and reduced motion
- Build an infinite news ticker that pauses on hover and focus and respects reduced motion
- Animate an element to the right over a duration with requestAnimationFrame, without CSS transitions
- 02display: none vs visibility: hidden vs opacity: 0
Lesson, 4 min read, then 3 questions to practise
- 03em vs rem vs px vs % in CSS
Lesson, 4 min read, then 4 questions to practise
- Predict CSS unit sizes: em, rem, percentages, line-height, calc() and clamp()
- Predict min-content, max-content and fit-content widths in labels, buttons and grid tracks
- Predict box model sizes: box-sizing, padding, borders and margin collapse
- Shrink text to fit its box with ResizeObserver and a binary search on font size, without a resize loop
- 04Flexbox vs Grid: when to use which?
Lesson, 4 min read, then 5 questions to practise
- Predict flexbox item sizes from flex-grow, flex-shrink and flex-basis
- Build a holy-grail layout with CSS Grid that stacks in narrow containers
- Center an element horizontally and vertically five ways
- Simulate CSS Grid auto-placement: explicit items, locked rows and the sparse cursor
- Build a flexbox layout engine: line breaking, grow and shrink with min/max freezing, and justify-content
- 08How do you keep an element's aspect ratio in CSS?
Lesson, 4 min read, then 3 questions to practise
- 09How does CSS specificity work?
Lesson, 4 min read, then 4 questions to practise
- Predict which color wins: specificity, !important and cascade layers
- Resolve the CSS cascade: origins, !important, layers, inline styles, specificity, inheritance and revert
- Predict which elements CSS selectors match: nth-child, nth-of-type, :not, :has and sibling combinators
- Choose cheap selectors and CSS containment: :has(), contain and content-visibility: auto
- 10inline vs block vs inline-block in CSS
Lesson, 4 min read, then 1 question to practise
- 11position relative vs absolute vs fixed vs sticky in CSS
Lesson, 4 min read, then 4 questions to practise
- Find the stacking context that traps an element's z-index
- Build a product comparison table with sticky headers and "highlight differences"
- Build a header that hides on scroll down and reappears on scroll up
- Build a modal stack manager: nested modals, focus restore, scroll lock counting and Escape for the top one
- 12reset.css vs normalize.css: what is the difference?
Lesson, 4 min read, then 1 question to practise
- 13Responsive vs adaptive design: what is the difference?
Lesson, 4 min read, then 3 questions to practise
- Switch a card's layout with CSS container queries and prove it by measuring three container widths
- Simulate how the browser picks an image from srcset and sizes: width and density descriptors and DPR
- Build flow and input hooks: useStep, useInputControl, useMediatedState, useBreakpoint and useCountdown
- 14What are pseudo-classes and pseudo-elements in CSS?
Lesson, 4 min read
- 15What is BEM in CSS?
Lesson, 6 min read, then 3 questions to practise
- 16What is mobile-first responsive design with media queries?
Lesson, 4 min read, then 1 question to practise
- 17What is the CSS box model?
Lesson, 4 min read
Chapter 2, intermediate
In depth
How it behaves under the hood, and the follow-ups that come next.
- 18Are CSS preprocessors like Sass still worth using?
Lesson, 4 min read, then 1 question to practise
- 19CSS custom properties vs Sass variables
Lesson, 5 min read, then 1 question to practise
- 20CSS Modules vs CSS-in-JS vs Tailwind: how to choose?
Lesson, 4 min read, then 1 question to practise
- 21CSS pixels vs device pixels: what is the device pixel ratio?
Lesson, 4 min read, then 3 questions to practise
- 22How do fr, minmax() and auto-fit work in CSS Grid?
Lesson, 6 min read, then 3 questions to practise
- 23How do you style SVG with CSS?
Lesson, 4 min read, then 4 questions to practise
- Build an accessible SVG histogram from raw data
- Build an analog clock in SVG: hand angles, a drift-free tick and time zones
- Build an SVG sparkline path: scaling, gaps for missing values, flat lines and min/max markers
- Build an expense tracker with category totals, an accessible SVG chart and a month filter
- 24What are CSS container queries?
Lesson, 6 min read, then 3 questions to practise
- 25What does content-visibility: auto do, and when is it better than virtualisation?
Lesson, 5 min read, then 3 questions to practise
- 26What does the CSS :has() selector do?
Lesson, 6 min read, then 1 question to practise
- 27What is a block formatting context (BFC) in CSS?
Lesson, 5 min read
- 28What is margin collapsing in CSS?
Lesson, 4 min read
- 29What is z-index, and what is a stacking context?
Lesson, 4 min read, then 1 question to practise