Responsive Design // Cheat-Sheet

Full terms + a quick-tips bank in every section, and a clickable Index at the back. Tick a box when a term clicks — progress saves on this machine.

0/0 learned
Core mindset
Responsive designthe whole idea
One layout that reshapes to fit any screen or container instead of shipping separate versions.
DJ Box: the same panel works docked, floating, wide-on-one-line, or clipped to the song.
Fluidvs fixed vs adaptive
Fluid flows with space (%,flex:1,vw). Fixed is hard pixels. Adaptive = fixed layouts that jump between set sizes.
DJ Box: the title/seek are fluid; the play button is fixed 36px.
Mobile-first
Design the smallest screen first, then add for bigger ones. Simpler, faster CSS.
Progressive enhancement / graceful degradation
Start with something that works everywhere, then layer on nicer behavior where supported (and still hold together where it isn't).
Content-out design
Let the content decide the breakpoints — add one where the design starts to look wrong, not at "phone/tablet/desktop" numbers.
Fluid typography
Type that scales smoothly with the viewport, usually via clamp(), instead of jumping at breakpoints.
Performance budget
A self-imposed cap (KB, requests, load time). Responsive isn't just layout — a phone on cell data needs it light.
⚡ Quick tips
  • Test at real widths, not just "desktop vs phone" — drag your window slowly.
  • DevTools device toolbar (Ctrl/Cmd+Shift+M) fakes screens fast.
  • Design the hardest state first (longest text, most items).
  • Prefer one flexible layout over many breakpoints.
  • "It looks fine on my screen" is the classic trap — others differ.
  • Ship the smallest thing users react to, then adjust.
  • Accessibility and responsiveness are the same discipline.
Reacting to size
Breakpoint
A width/height where the layout intentionally changes. Chosen where the design breaks.
DJ Box: under ~470px we drop extra transport buttons and the Next chip.
Media query
CSS reacting to the viewport: @media (max-width:900px){…}.
PULSE: @media(max-width:900px) collapses the shell to one column.
min-width vs max-width queries
min-width = mobile-first (add as it grows); max-width = desktop-first (override as it shrinks). Pick one direction and stay consistent.
Container querynewer
React to a parent element's size, not the screen — so a component adapts wherever it's dropped. Needs container-type on the parent.
ResizeObserverJS
JS watcher that fires when an element changes size — for when CSS can't decide.
DJ Box: respond() runs on one to reveal the queue from the box's own height.
matchMedia()JS
Read a media query from JavaScript and get notified when it flips: matchMedia('(max-width:600px)').
IntersectionObserverJS
Fires when an element enters/leaves the viewport — powers lazy-loading, reveal-on-scroll, infinite lists.
Media featuresorientation, hover, pointer…
Queries beyond width: orientation, prefers-color-scheme, hover, pointer:coarse (finger vs mouse), prefers-reduced-motion.
Viewport meta tag
<meta name="viewport" content="width=device-width,initial-scale=1"> — without it, phones fake a desktop width.
⚡ Quick tips
  • Common breakpoints to start: ~480, ~768, ~1024, ~1280px.
  • Use ranges: @media (min-width:600px) and (max-width:900px).
  • pointer:coarse = touch device — bump target sizes.
  • prefers-color-scheme:dark auto-themes for dark-mode users.
  • Container queries beat media queries for reusable components.
  • Always disconnect observers when done to avoid leaks.
  • Debounce heavy work inside resize handlers.
Layout engines
Flexbox1-D
Lays items in a row or column that grow, shrink, and wrap. The workhorse for components.
DJ Box: the whole control bar is one flexbox.
flex-grow / shrink / basisflex: shorthand
flex:grow shrink basis — basis=start size, grow=greed for spare space, shrink=willingness to give it up.
DJ Box: song core flex:3 1 290px beats seek flex:1 1 150px for the extra room.
flex-wrap
Items drop to a new line instead of overflowing.
DJ Box: widen it and controls land on one line; narrow it and they wrap.
justify-content / align-items
Alignment: justify-content along the main axis, align-items across it. space-between, center, stretch
gap
Spacing between flex/grid children without margin hacks: gap:8px 11px (row col).
order
Reorder flex/grid items visually without touching the HTML — handy for moving a sidebar below on mobile.
CSS Grid2-D
Rows and columns together for page structure: grid-template-columns:minmax(0,1fr) 300px.
PULSE: the shell is a grid; floating the DJ Box flipped it to one 1fr column.
minmax() + auto-fit / auto-fill
Responsive grids with no media queries: repeat(auto-fit,minmax(240px,1fr)) flows columns by available width.
This sheet: the tips lists use exactly that.
fr unit & grid-template-areas
fr = a fraction of free space. Named areas let you draw the layout as ASCII and re-arrange it per breakpoint.
min-width: 0truncation trick
Flex/grid items won't shrink below content by default → overflow. min-width:0 frees them so ellipsis works.
DJ Box: why long titles get "…" instead of blowing out the box.
Multi-columncolumns
columns:2 flows text/items into newspaper columns; break-inside:avoid stops items splitting.
This sheet: the Index uses columns:2.
⚡ Quick tips
  • Flexbox for components, Grid for page layout — rough rule.
  • flex:1 = flex:1 1 0 = "share space equally."
  • flex-basis:auto respects content size; 0 ignores it.
  • place-items:center = one-line perfect centering in Grid.
  • margin-left:auto in flex pushes an item to the far end.
  • Avoid fixed heights on containers — let content set them.
  • gap beats margins for even spacing every time.
  • Subgrid lets children align to a parent grid's tracks.
Sizing units & math
rem / em
rem = relative to root font size (predictable). em = relative to the element's own (compounds). Scale with the user's text setting.
vw / vh / vmin / vmax
Viewport percentages. 50vw = half window width; vmin/vmax = smaller/larger side.
DJ Box: max-width:96vw keeps it on-screen.
dvh / svh / lvhthe 100vh fix
Dynamic/small/large viewport height — fix the mobile "100vh is too tall under the URL bar" bug. Use 100dvh.
% (percentage)
Relative to the parent's size — needs the parent to have a defined size.
min() / max() / clamp()fluid but bounded
clamp(min,ideal,max) = fluid, never past the ends. The modern fluid-type/space one-liner.
calc()
Mix units in math: calc(100% - 48px). Everyday for "full width minus a fixed thing."
ch / ex
ch ≈ width of a "0" — great for capping line length (max-width:65ch = readable measure).
Unitless line-height
line-height:1.5 (no unit) scales with each element's font size — always prefer it over px.
Intrinsic vs extrinsic sizing
Intrinsic = content-sized (fit-content,min-content). Extrinsic = container-sized (100%,flex:1).
aspect-ratio
aspect-ratio:16/9 keeps shape while scaling — video, posters, thumbnails.
⚡ Quick tips
  • Set font-size in rem, spacing in rem, borders in px.
  • max-width:65ch keeps paragraphs readable.
  • Fluid type: font-size:clamp(1rem,2.5vw,1.5rem).
  • Swap 100vh100dvh on mobile full-screens.
  • Never hard-code widths that must fit text — use ch/fit-content.
  • Container query units cqw/cqi size to the container.
  • Respect user zoom — avoid px-locked layouts.
Overflow, scroll & stacking
Overflow / clipping
overflow:hidden|auto|scroll — cut off, or allow scrolling, when content exceeds the box.
DJ Box: overflow:hidden is what "clips down to the song + ▶".
overflow-x / overflow-y
Control axes separately — e.g. a horizontally scrolling row inside a fixed-height card.
Scroll snap
scroll-snap-type + scroll-snap-align = carousels/pagers that snap to each item. Pure CSS.
overscroll-behavior
overscroll-behavior:contain stops a scroll inside a panel from scrolling the page behind it.
Hidden scrollbars
scrollbar-width:none + ::-webkit-scrollbar{display:none} scroll without a visible bar.
DJ Box: the queue scrolls with no ugly bar exactly this way.
position: fixed / absolute / sticky
fixed = pinned to screen, absolute = pinned to a positioned parent, sticky = scrolls then sticks.
DJ Box: panel is fixed; the × is absolute in the corner.
z-index / stacking context
Higher z-index sits on top — but only within its stacking context (a positioned/opacity/transform ancestor makes a new one).
Box model & box-sizing
box-sizing:border-box makes width include padding+border. Set globally, forget the pain.
clip-path / mask
Cut elements into shapes or fade edges. mask:linear-gradient(...) feathers overflow prettily.
This sheet: the grid backdrop fades via a mask.
contain / content-visibility
Perf hints. content-visibility:auto skips rendering off-screen chunks — big wins on long pages.
⚡ Quick tips
  • Global *{box-sizing:border-box} is line one of every project.
  • Only the main page should scroll — avoid nested scroll traps.
  • min-height:0 lets a flex child actually scroll inside.
  • Reach for z-index sparingly; fix stacking context first.
  • position:fixed breaks inside transformed parents — gotcha.
  • overscroll-behavior:contain on modals/drawers.
  • Feather edges with mask instead of hard clips.
Media, polish & gotchas
Touch targets
Tappable things ~44×44px minimum so fingers hit them. Accessibility + delight.
Responsive images: srcset / sizes
srcset offers multiple resolutions; sizes tells the browser how big it'll render, so it downloads the right one.
<picture> element
Serve different images (art direction / formats like WebP/AVIF) per condition — not just sizes.
Lazy loading
loading="lazy" defers off-screen images/iframes until they're near the viewport.
Device pixel ratio (retina)
Phones pack 2–3 physical px per CSS px. Use SVG or 2× assets to stay crisp.
Cumulative Layout Shift (CLS)
Content jumping as things load. Reserve space (width/height or aspect-ratio) so nothing pops.
Safe areas / notches
env(safe-area-inset-*) keeps content clear of notches and home bars.
prefers-reduced-motion
Respect users who get motion-sick — dial animations down when it's set.
:focus-visible & keyboard nav
Show focus rings for keyboard users (not mouse clicks). Never remove focus styles outright.
font-display: swap
Show fallback text immediately while a web font loads — avoids invisible text (FOIT).
pointer-events / hit testing
pointer-events:none lets clicks pass through decorative overlays to what's beneath.
DJ Box: the resize grip is pointer-events:none so the native handle underneath still works.
⚡ Quick tips
  • Give images explicit width/height (or aspect-ratio) to kill CLS.
  • Prefer SVG for icons — sharp at any DPR, tiny.
  • Serve AVIF/WebP with a JPEG/PNG fallback via <picture>.
  • loading="lazy" on below-the-fold media.
  • Keep tap targets 44px+ and spaced apart.
  • Test with a keyboard only — Tab through everything.
  • Honor prefers-reduced-motion for every animation.
  • Watch out: 100vh under mobile URL bars — use dvh.
Where to learn (free first)
Free
web.dev — Learn Responsive Design & Learn CSS
Google's structured course. Best path for exactly this.
Free
MDN — Responsive design
The reference docs you'll live in.
Free
Kevin Powell — YouTube
Teaches flexbox/grid/responsive better than anyone.
Free
Flexbox Froggy & Grid Garden
Browser games — flex/grid finally clicks.
Free
Every Layout
Deep "why" on resilient layouts (some chapters paid).
CSS for JS Developers — Josh Comeau
The best paid deep-dive.
Responsive Web Design — Ethan Marcotte
The short book that started it all.
Want live Amazon links + current prices for the paid ones? Ask "links + prices."
Index — one-line quick reference
Nothing matches that search.
Responsive Design TCV Cheat-Sheet — built for the Clemit projects · ~Jesse
Ticks saved locally in this browser. The Index at the back jumps you to any term.