Ch. 08 — Responsive + a11y
Chapter 08

Responsive Design & Accessibility

A beautiful website that breaks on mobile isn't beautiful. And one that excludes people isn't either.

⏱ 1 hour 🛠 VS Code · Chrome browser

Two things that aren't optional

Responsive design and accessibility are often treated as features you add at the end. They're not. They're baseline requirements — the floor of what "good" means on the web today.

Responsive: Over 60% of web traffic globally is on mobile devices. If your website breaks on a phone screen, you've excluded the majority of your audience before they've seen a single word of your content.

Accessibility (a11y — that's the 11 letters between "a" and "y" in "accessibility"): Roughly 1 in 7 people globally has some form of disability — visual, auditory, motor, or cognitive — that affects how they use the web. Laws in many countries (ADA in the US, EN 301 549 in the EU) require digital accessibility. And here's the thing: accessible design is almost always better design for everyone. Captions help people in noisy environments. High contrast helps people in bright sunlight. Keyboard navigation helps power users.

Responsive design — making things adapt

A responsive website doesn't have a separate "mobile version" — it's the same website, but the layout adapts to the screen size. The main CSS tool for this is the media query.

A media query says: "only apply these CSS rules if the screen is this wide." Here's an example:

CSS — Media Queries
/* Mobile-first: default styles apply to all screens */
.card-grid {
  display: flex;
  flex-direction: column; /* Stack cards vertically on mobile */
  gap: 16px;
}

/* When screen is 768px wide or more (tablet+): */
@media (min-width: 768px) {
  .card-grid {
    flex-direction: row;   /* Cards go side by side */
    flex-wrap: wrap;       /* Wrap to next row if needed */
  }
}

/* When screen is 1200px wide or more (desktop): */
@media (min-width: 1200px) {
  .card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 equal columns */
  }
}

Notice the approach: mobile-first. You write your default CSS for mobile (small screens), then use media queries to add rules for larger screens. This is the modern standard. It's also more logical: start simple, then add complexity for bigger screens.

📖 Jargon decoded
What's a "breakpoint"?
A breakpoint is the screen width at which your layout changes. Common breakpoints: 390px (mobile), 768px (tablet), 1280px (desktop). When you write a media query at 768px, that's your breakpoint — the point where your layout "breaks" from one configuration to another. In Figma, when you design frames at different sizes, you're designing at breakpoints.

Testing responsiveness in Chrome

You don't need to own an iPhone and an iPad and a desktop to test responsive design. Chrome DevTools has a device simulation mode built in.

Open DevTools (Cmd + Option + I). Click the device icon in the top-left of the DevTools panel (it looks like a phone and tablet overlapping). This activates Device Mode — your page now renders at any screen size you choose.

Common sizes to test: 390px (iPhone 14), 768px (iPad), 1280px (laptop), 1920px (desktop). Drag the edges of the simulated screen to resize it — watch your layout change in real time. This is the fastest feedback loop in responsive development.

Accessibility — designing for everyone

Accessibility isn't a checklist you run through at the end of a project. It's a set of design principles that, when applied from the start, make products better for everyone. Here are the four most important things to understand:

  • Semantic HTML — use the right element for the right job. A button should be a <button>, not a <div> you styled to look like a button. A heading should be an <h1> or <h2>, not bold text in a <div>. Why? Screen readers (software used by visually impaired people) read out loud based on HTML structure. A <button> is announced as "button." A <div> that looks like a button is announced as nothing. Also: <button> works with the keyboard by default. <div> doesn't.
  • Color contrast — the difference in brightness between your text color and background color must be high enough for people with low vision to read. The minimum standard (called WCAG AA) is a contrast ratio of 4.5:1 for normal text. You can check any two colors at webaim.org/resources/contrastchecker — free, no account needed.
  • Alt text on images — every <img> element needs an alt attribute describing what the image shows. Screen readers read this aloud to blind users. <img src="photo.jpg" alt="A smiling person holding a cup of coffee">. If the image is purely decorative, use alt="" — this tells the screen reader to skip it.
  • Keyboard navigation — every interactive element (buttons, links, form inputs) should be reachable and usable with just the Tab key, without a mouse. Press Tab on any webpage and watch the focus move through interactive elements. If your button can't be reached by Tab, keyboard users can't use it.
📖 Jargon decoded
What's WCAG?
WCAG stands for Web Content Accessibility Guidelines — the internationally recognized standards for digital accessibility, published by the W3C (the organization that sets web standards). WCAG has three levels: A (minimum), AA (standard requirement in most laws), and AAA (the gold standard). When a company says "we're WCAG 2.1 AA compliant," they mean they meet the standard-level accessibility requirements. Knowing this acronym and using it confidently will impress any product team.

Practical accessibility for designers

You don't need to audit code to do accessibility work as a designer. Here's what you do in Figma and in your process:

  • Check contrast ratios in Figma before handoff. Select a text layer — the right panel shows the fill color. Compare it to the background color at webaim.org/resources/contrastchecker. If it fails AA, adjust the colors until it passes.
  • Label every interactive element. Buttons that are just icons (like a trash icon or a close X) need an invisible text label in the design spec — called an "aria-label." Note it in your Figma: "aria-label: Delete item."
  • Design focus states. Every interactive element has a "focused" state — what it looks like when selected via keyboard. This is often completely forgotten. Design it explicitly: a visible outline, a highlight, anything that shows "this element is selected."
  • Test at 200% zoom. In Chrome, press Cmd + + to zoom in to 200%. Does your layout still work? Can you still read everything? This simulates how many users with low vision browse the web.
📱
Hands-on activity
Make your card responsive and accessible
You need: VS Code Chrome browser (DevTools) webaim.org (free, no account)
  1. 1
    Open your index.html from Chapter 02 in VS Code. Make sure it has this in the <head>: <meta name="viewport" content="width=device-width, initial-scale=1.0">. This is required for responsive design to work on mobile — without it, mobile browsers zoom out and render a tiny desktop layout.
  2. 2
    Open the file in Chrome. Open DevTools and switch to Device Mode (phone/tablet icon). Set the width to 390px. Does your card look reasonable? If it's overflowing or breaking, add a media query to fix it: switch any horizontal flex layout to flex-direction: column at small widths.
  3. 3
    Find the hex color of your text and the hex color of your background. Go to webaim.org/resources/contrastchecker. Enter both colors. Does it pass AA (ratio of 4.5:1 or higher for normal text)? If not, adjust your text color to be brighter/darker until it passes.
  4. 4
    Check your HTML: if you have a button, is it a <button> element? If you have a main heading, is it <h1>? If you used <div> for these, change them to the semantic elements.
  5. 5
    Open DevTools → Lighthouse tab → click "Generate report" with "Accessibility" checked. Aim for a score above 90. Fix whatever Lighthouse flags — it explains each issue and links to documentation on how to fix it.
Try it right here
Add a media query — make it responsive
✦ Own your code
Can you explain every line?
Before moving on: pick any 5 lines from the code above and say out loud what each one does. Not the general idea — the specific line. If Claude ever gives you code like this, hold it to this standard before you use it. If you cannot explain a line, you cannot debug it.
Key takeaways
  • Responsive design = your layout adapts to any screen size using CSS media queries
  • Mobile-first: write styles for mobile first, then add styles for larger screens with @media (min-width: ...)
  • Use Chrome DevTools Device Mode to test any screen size without owning multiple devices
  • Use semantic HTML: <button> for buttons, <h1> for headings — not <div> for everything
  • Check color contrast: minimum 4.5:1 ratio for body text (WCAG AA standard)
  • Design focus states — keyboard users need to see which element is selected