Responsive Layout
Overview
Responsive layout makes content adapt gracefully across screen sizes using a mix of fluid units, breakpoints (media queries), and intrinsic techniques where the layout itself flexes without explicit breakpoints. web.dev's Learn Responsive Design is the official course; MDN's Grid module is the canonical reference for the two-dimensional engine that powers intrinsic layouts. Read this when building pages or components that must work everywhere.
Official sources
Core concepts
- Media queries — adapt designs to screen/device characteristics at chosen breakpoints (web.dev — Media queries).
- Macro vs. micro layouts — page-level structure vs. flexible components that can be placed anywhere (web.dev — Macro/Micro layouts).
- Intrinsic layout — let content and the grid decide sizing (e.g.,
auto-fit + minmax) so fewer hard breakpoints are needed (MDN Grid; web.dev layout).
- Grid tracks, lines, areas — the structural primitives for two-dimensional responsive layouts (MDN Grid).
fr, minmax(), auto-fill/auto-fit — flexible track sizing that distributes space and wraps automatically (MDN Grid).
- Container queries — components respond to their container's size, complementing viewport media queries (web.dev — Micro layouts / container queries).
- Theming & media features — adapt to preferences like dark mode and reduced motion (web.dev — Theming/Media features).
Best practices
- Build components as micro layouts that flex anywhere, rather than assuming a fixed page position (web.dev — Micro layouts).
- Prefer intrinsic sizing (
repeat(auto-fit, minmax(...))) to reduce the number of manual breakpoints (MDN Grid).
- Use media queries for macro page structure and container queries for component-level adaptation (web.dev).
- Honor user preferences (dark mode, reduced motion) via media features as part of responsiveness (web.dev — Media features/Theming).
Common pitfalls
- Pixel-perfect fixed widths that break between breakpoints → use fluid units and
minmax() so layouts fill the gaps (MDN Grid).
- Relying only on viewport media queries for reusable components → add container queries so they reflow in any context (web.dev).
- Designing desktop-first and retrofitting small screens → start from flexible, content-driven layouts (web.dev — Macro layouts).
Examples
/* Intrinsic, breakpoint-light card layout */
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
/* Macro layout switch at a deliberate breakpoint */
@media (min-width: 64rem) {
.page { grid-template-columns: 16rem 1fr; } /* sidebar + content */
}
Further reading
Related skills
- ../css-techniques — grid, flexbox, and container query fundamentals
- ../graphic-design-basics — grid and spacing principles behind layouts
1---2name: responsive-layout3description: Fluid, breakpoint, and intrinsic layout strategies for any screen; consult when making pages and components adapt across viewports and containers.4domain: design5category: design6tags: [responsive, layout, css-grid, media-queries, container-queries, intrinsic]7official_sources:8 - https://web.dev/learn/design/9 - https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout10verified: 2026-06-1611metadata:12 source: https://skillmd.com/skills/gabriel7silva/responsive-layout13---1415# Responsive Layout1617## Overview18Responsive layout makes content adapt gracefully across screen sizes using a mix of fluid units, breakpoints (media queries), and intrinsic techniques where the layout itself flexes without explicit breakpoints. web.dev's Learn Responsive Design is the official course; MDN's Grid module is the canonical reference for the two-dimensional engine that powers intrinsic layouts. Read this when building pages or components that must work everywhere.1920## Official sources21- web.dev — Learn Responsive Design: https://web.dev/learn/design/22- MDN — CSS Grid Layout: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout2324## Core concepts25- **Media queries** — adapt designs to screen/device characteristics at chosen breakpoints (web.dev — Media queries).26- **Macro vs. micro layouts** — page-level structure vs. flexible components that can be placed anywhere (web.dev — Macro/Micro layouts).27- **Intrinsic layout** — let content and the grid decide sizing (e.g., `auto-fit` + `minmax`) so fewer hard breakpoints are needed (MDN Grid; web.dev layout).28- **Grid tracks, lines, areas** — the structural primitives for two-dimensional responsive layouts (MDN Grid).29- **`fr`, `minmax()`, `auto-fill`/`auto-fit`** — flexible track sizing that distributes space and wraps automatically (MDN Grid).30- **Container queries** — components respond to their container's size, complementing viewport media queries (web.dev — Micro layouts / container queries).31- **Theming & media features** — adapt to preferences like dark mode and reduced motion (web.dev — Theming/Media features).3233## Best practices34- Build components as micro layouts that flex anywhere, rather than assuming a fixed page position (web.dev — Micro layouts).35- Prefer intrinsic sizing (`repeat(auto-fit, minmax(...))`) to reduce the number of manual breakpoints (MDN Grid).36- Use media queries for macro page structure and container queries for component-level adaptation (web.dev).37- Honor user preferences (dark mode, reduced motion) via media features as part of responsiveness (web.dev — Media features/Theming).3839## Common pitfalls40- Pixel-perfect fixed widths that break between breakpoints → use fluid units and `minmax()` so layouts fill the gaps (MDN Grid).41- Relying only on viewport media queries for reusable components → add container queries so they reflow in any context (web.dev).42- Designing desktop-first and retrofitting small screens → start from flexible, content-driven layouts (web.dev — Macro layouts).4344## Examples45```css46/* Intrinsic, breakpoint-light card layout */47.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }4849/* Macro layout switch at a deliberate breakpoint */50@media (min-width: 64rem) {51 .page { grid-template-columns: 16rem 1fr; } /* sidebar + content */52}53```5455## Further reading56- web.dev Learn Responsive Design modules: https://web.dev/learn/design/57- MDN Grid layout guides: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout5859## Related skills60- ../css-techniques — grid, flexbox, and container query fundamentals61- ../graphic-design-basics — grid and spacing principles behind layouts