Container Queries
Components that respond to the size of their container rather than the viewport, enabling truly modular, context-aware design systems.
Unit 5 — Animation Practice
A curated collection of the CSS features that have reshaped how we build for the web, from container queries to cascade layers to scroll-driven animations.
Components that respond to the size of their container rather than the viewport, enabling truly modular, context-aware design systems.
A perceptually uniform color space where equal numeric steps produce equal perceived brightness changes, making programmatic color manipulation predictable.
Tie animation progress directly to scroll position using the
animation-timeline property, with no JavaScript event listeners required.
Automatically distributes text across lines to eliminate awkward single-word orphans in headings and short paragraphs.
Lets nested elements participate in a parent grid's tracks, solving the long-standing problem of aligning content deep inside card components.
Mix two colors in any color space directly in CSS, enabling tints, shades, and blends that previously required a preprocessor or JavaScript.
Animate between DOM states or page navigations with a snapshot-based cross-fade that the browser handles automatically.
A single font file that exposes adjustable axes like weight, width, and slant, reducing HTTP requests while expanding typographic control.
Explicit layers of specificity that let you structure your CSS so utility classes and overrides no longer require specificity wars.
A CSS function that returns one of two values depending on the current color scheme, collapsing what used to require two separate media query blocks.
A JavaScript interface for creating and controlling animations with the same performance characteristics as CSS animations, plus programmatic playback control.
Normalizes the perceived size of fallback fonts so text remains consistently readable during the brief window before a web font loads.
Grid and Flexbox solved the hard problems of page and component layout years ago, but container queries and subgrid fill in the gaps that remained. Components can now adapt to their context without any knowledge of the page they live in.
Cascade layers complement this by giving you explicit control over specificity, so your design system, third-party styles, and utility overrides all coexist without conflict.
The move to perceptually uniform color spaces like oklch means that generating a color palette programmatically actually looks right. Every step in lightness reads as the same visual distance to the human eye.
Functions like color-mix() and light-dark() bring
logic directly into CSS that previously required a build tool or multiple
media query blocks to express.
Scroll-linked animations used to mean attaching a scroll event listener, calculating offsets on every frame, and hoping the main thread was free. Scroll-driven animations replace all of that with two CSS properties.
The View Transitions API handles the JavaScript side of animated state changes,
leaving CSS to define how the transition looks via the
::view-transition-old and ::view-transition-new
pseudo-elements.
Small typographic improvements like text-wrap: balance are the
kind of polish that designers have always wanted but had to fake with manual
line breaks or JavaScript. Now a single property handles it automatically.
Variable fonts and font-size-adjust address performance and
consistency concerns that were previously impossible to solve purely in CSS,
removing another category of JavaScript workarounds entirely.