Skip to the page

Web platform · 10 concepts

CSS and layout

The cascade, layout systems and the layout tasks machine-coding rounds ask for.

Asked in these mock interviews

Part 1 · 4 concepts

The cascade and the box

  1. 01

    The box model and box-sizing

    Every element is a box of content, padding, border and margin; with box-sizing: border-box the width includes padding and border, which is why most resets use it.

  2. 02

    Specificity, the cascade and @layer

    When rules conflict, the cascade decides by origin and importance, then cascade layer, then specificity (id, class, element counts), then source order; @layer lets you…

  3. 03

    Positioning, z-index and stacking contexts

    position decides what top/left are relative to (relative: itself, absolute: the nearest positioned ancestor, fixed: the viewport, sticky: its scroll container until it…

  4. 04

    Hiding things: display, visibility, opacity and accessibility

    display: none removes the element from layout and the accessibility tree, visibility: hidden keeps its space but hides it from everyone, opacity: 0 keeps it clickable…

Part 2 · 3 concepts

Layout systems

  1. 05

    Flexbox, including centering

    Flexbox lays items out in one direction: justify-content works on the main axis, align-items on the cross axis, and flex: grow shrink basis decides how items share space.

  2. 06

    Grid, and grid vs flexbox

    Grid lays items out in two dimensions with explicit tracks (grid-template-columns: repeat(auto-fill, minmax(200px, 1fr))), while flexbox is content-first in one…

  3. 07

    Responsive design, units and container queries

    Responsive design starts mobile-first with fluid units (rem, %, fr, clamp(), dvh), adds media queries for the page and container queries for components, so a card…

Part 3 · 3 concepts

CSS in real projects

  1. 08

    Animations and their performance

    Use transitions for state changes and @keyframes for loops, animate only transform and opacity for smooth 60fps motion, and respect prefers-reduced-motion.

  2. 09

    Styling approaches: BEM, CSS Modules, CSS-in-JS, Tailwind

    Each approach solves global-CSS collisions differently: BEM by naming, CSS Modules by build-time scoping, runtime CSS-in-JS by generating styles in JS (with a runtime…

  3. 10

    Building a layout live from a screenshot

    In a live layout round, first sketch the structure (header, sidebar, content, cards), choose grid for the page and flex for rows, use semantic elements, and get the…

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview