03.3.5 · Skill in UI design

Responsive design

Interfaces that work across screen sizes and input methods.

Responsive design adapts layout and interaction to phones, tablets and desktops, and to touch, mouse and keyboard. It is more than shrinking things down. Content priorities often change on small screens.

Your status · Responsive design

Saved in this browser. Sign in to keep it on every device.It colours this skill's tile on your map.

Why it matters for a product engineer

People use the same product on a phone, a tablet and a laptop, with touch, a mouse or a keyboard. Responsive design adapts the layout and the interaction to each. It is more than making things smaller: on a small screen the order of content and the size of targets change too. Almost all of it is code.

How to do it

  1. Add the viewport meta tag. Without it, a phone renders the page at a desktop width, often about 980 px, and shrinks it.
  2. Start from the smallest screen and add layout as space allows.
  3. Let the content choose the breakpoints: add one where the layout starts to look wrong, not at the width of a popular device.
  4. Size things in relative units, and let images and media scale with their container.
  5. Make touch targets large enough for a thumb, and do not depend on hover.
  6. Test on real devices, at real widths such as 390 px, in both orientations.

Common mistakes

  • Designing for desktop and squeezing it onto a phone.
  • Hiding content on small screens that people need there.
  • Breakpoints for specific devices, which break on the next device.
  • Text or controls that only work with a mouse.

Example

An agent’s audit of RelievApp asked for every scene to be checked at 390 px in each look. The minimal look needed its own contrast pass: white text over the pale sphere was hard to read, and “Drag up to breathe in” almost disappeared. A layout that works at one width and in one theme is not yet done. (RelievApp in In practice)

Anatomy

The one line every responsive page needs

<meta name="viewport" content="width=device-width1, initial-scale=12">

  1. 1Match the screenUse the device's width, not a desktop width.
  2. 2No zoomStart at 100%, so the page is not shrunk to fit.

Without this line, phones lay the page out about 980 px wide and shrink it, and people have to zoom to read.

Reportedweb.dev, Responsive web design basics

Sources: Responsive web design basics (web.dev) ↗ · Learn responsive design (Jeremy Keith, web.dev) ↗

Resources

2
  • articleStart here
    Responsive web design basics ↗
    web.dev (Google) · 2019 · 13 min

    The essentials in one article, from the viewport tag to media queries.

  • courseGo deeper
    Learn responsive design ↗
    Jeremy Keith (web.dev) · free course

    A complete free course on responsive layouts, typography, images and interaction for every screen.

Tools

2
Tools for UI design
  • ToolFreemium
    Figma

    Collaborative interface design and prototyping in the browser, the industry default.

  • ToolOpen source
    Penpot

    Open-source design and prototyping tool, self-hostable, built on open web standards.