skip to content

How do you choose the breakpoint values for a responsive CSS layout, and why are device categories like "tablet" a poor basis for them?

level: middleimportance: should knowfreq 58%

answer

  1. drag the window until it looks wrong
  2. the layout owns the breakpoint, not the device
  3. viewport widths are a continuum
  4. rem conditions follow the default font size
  5. fewer breakpoints, fewer states to check

basics

~20 s

Derive breakpoints from the content: widen the browser slowly and add a breakpoint at each width where the design actually stops working. Device categories are a poor basis because real viewport widths form a continuum that no fixed device list covers.

solid answer

~50 s

I resize the window slowly from around 320px upward and watch for the moment the design fails — line length gets uncomfortably long, cards squash below a usable width, navigation wraps badly, a table starts overflowing. That width is the breakpoint, and it belongs to that layout rather than to a device. Device-named breakpoints fail for a few concrete reasons: viewport widths are a continuum, not three clusters; a phone in landscape, a tablet in split-screen and a half-width desktop window all land in gaps between the presets; and the popular numbers date from specific hardware that no longer dominates. I also prefer few breakpoints over many, and express them in `rem` or `em`, because in a media query condition those resolve against the browser's initial font size — so a reader who raised their default text size gets the simpler layout sooner, which is usually what they want.

code

css · 10 lines
css
.prose { max-width: 65ch; }

/* Derived by widening until the single column left too much empty space */
@media (min-width: 45rem) {
  .layout {
    display: grid;
    grid-template-columns: 18rem 1fr;
    gap: 2rem;
  }
}

go deeper

for a junior

Be able to describe the method rather than a number: widen the window slowly and put the breakpoint where the design first looks wrong. Saying that breakpoints come from the content, not from a device list, is the answer at this level.

for a middle

Name the concrete failure modes you are watching for — line length past roughly 45–75 characters, components squashed below their usable width, overflow — and explain why device categories only sample a continuous range of widths.

for a senior

Show that you keep the breakpoint count deliberately low, prefer layouts that absorb size change continuously, and validate against real content and the extremes rather than a preset list.

for a principal

Frame breakpoints as a cost that multiplies across the component inventory, and be ready to argue when a team's request for one more shared breakpoint should instead be a local adjustment inside a single component.

## The method, concretely Open the page at roughly 320px wide — narrow enough to represent a small phone — and drag the window edge slowly wider. Do not think about devices at all. Watch for the first width at which the design becomes *worse* rather than merely bigger. That is your breakpoint. Add the query, fix the design above that width, and continue dragging. Repeat until you run out of width. The breakpoint set that falls out belongs to that specific layout, and two different components on the same site will legitimately want different values. The useful part of this method is that it forces you to name **what** breaks. Common triggers: - **Line length.** Body text becomes hard to read past roughly 45–75 characters per line. A full-width paragraph crosses that around the same width on most type scales, so a max-width or a second column is due. - **Squashed elements.** A card, a form field or a nav item has a width below which it stops working — labels wrap onto three lines, a button's text clips. That minimum is a property of the component, not of a device. - **Wasted space.** A single column with enormous empty margins on both sides is the signal to add a sidebar or a second column. - **Overflow.** A table, a code block or a long unbroken string starts pushing a horizontal scrollbar. ## Why device names are the wrong axis Four reasons, all checkable: 1. **Widths are a continuum.** Plot real viewport widths and you get a smear, not three clusters. Every gap between named presets is a width that real users have. 2. **Devices produce several widths each.** One tablet is two widths depending on orientation, three if the OS supports split-screen, and a desktop browser is *every* width because windows are resizable. 3. **The famous numbers are archaeology.** 768 and 1024 are the portrait and landscape widths of a specific early tablet; 320 is an early phone. They persist as habit, and where they happen to be right it is coincidence, not derivation. 4. **They encourage the wrong count.** "Phone, tablet, desktop" implies three breakpoints for everything, including layouts that need one and layouts that need four. The deeper objection is that a device name tells you nothing about the failure. "It breaks on tablet" is not actionable; "the card grid squashes below 15rem per card, which happens at about 46rem of container width" is. ## Units: prefer rem or em Inside a media query condition, `em` and `rem` both resolve against the **initial** font size — the browser's default, as modified by the user's preferences — not against the root element's computed `font-size`. That is a genuinely useful property: ```css /* fires at 720px for a default 16px, and earlier if the reader raised it */ @media (min-width: 45rem) { .layout { grid-template-columns: 18rem 1fr; } } ``` A reader who set their default text size to 20px effectively gets a viewport that holds less text, and the `rem` breakpoint moves with them, handing over the simpler layout at a wider pixel width. A `px` breakpoint ignores that setting entirely. It is a small robustness win that costs nothing. ## Fewer breakpoints, not more Each breakpoint is a state that has to be designed, reviewed and re-checked for every component that crosses it. Before adding one, ask whether the layout can absorb the change continuously instead — wrapping rows, flexible track sizing and fluid spacing all reduce the number of discrete jumps a design needs. Breakpoints are for the moments where the layout must genuinely *rearrange*, not for every size adjustment along the way. ## Testing the choices Having derived breakpoints from content, verify with content — real copy, the longest product name in the catalogue, a user with two given names. Placeholder text has uniform length and hides exactly the wrapping failures that breakpoints exist to fix. ## What a strong answer sounds like A process, then a reason, then a caveat: "drag the window until it breaks, put the breakpoint there, because widths are a continuum and device presets only sample it — and keep the count low, because every breakpoint multiplies the states you have to check."

  • Why does using rem instead of px for a breakpoint condition matter?
    In a media query condition, `em` and `rem` resolve against the browser's initial font size rather than the root element's computed size. So a reader who raised their default text size shifts every rem breakpoint outward and reaches the simpler, roomier layout at a wider pixel width — which is what they need, since their text takes more space. A px condition is blind to that preference. It costs nothing to write 45rem instead of 720px.
  • Two components on one page want different breakpoints. Do you standardise them or let them differ?
    It depends on whether they share space. Components sitting in the same layout region should usually rearrange together, or the page reflows in a stutter of small jumps — so I would align them on the wider of the two values. Components in independent regions can genuinely differ, and forcing them onto one number just makes one of them break early. What I would not do is invent a new global breakpoint to serve a single component.
  • How do you sanity-check a breakpoint set once it exists?
    Sweep the whole width range with real content, not preset jumps and not placeholder text — the longest product name, a two-line heading, an empty state. Then check the extremes: around 320px, and very wide where a layout with no upper bound stretches lines past readability. If a breakpoint never visibly changes anything with real content in it, it is not earning its place and I would remove it.

saying these in an interview costs you the question

  • Copies 768px and 1024px because a framework uses them
  • Treats phone, tablet and desktop as three fixed widths
  • Adds a breakpoint for every size tweak rather than rearrangements
  • Tests only with placeholder text of uniform length
  • Assumes px and rem breakpoints behave identically for all users

context