Why websites use responsive design

Open the same website on a phone, a tablet and a wide monitor and, if it is well built, you will see three different layouts of the same…

Illustration for the article: Why websites use responsive design

Updated:

Open the same website on a phone, a tablet and a wide monitor and, if it is well built, you will see three different layouts of the same content: a single column with a compact menu, two columns with larger text, a multi-column page with a sidebar. Nothing was duplicated to achieve this. The site is responsive: one set of pages whose layout adapts to the device showing them. Responsive design became the default approach in the early 2010s for reasons that still apply, and it affects search rankings, maintenance costs and how comfortable a page is to read.

Fluid layouts, media queries and flexible images

Responsive design rests on a few techniques that work together.

  • Fluid layouts. Widths are expressed in percentages, viewport units or flexible grid tracks rather than fixed pixels, so containers stretch and shrink with the screen.
  • Media queries. CSS rules can be conditional on the viewport’s width, height, orientation or pixel density. A rule such as @media (min-width: 60em) switches from one column to three once there is room.
  • Flexible images and video. Images are told never to exceed their container, and the srcset attribute lets the browser choose an appropriately sized file, so a phone does not download a 3000-pixel photo to display it 360 pixels wide.
  • The viewport meta tag. Without <meta name="viewport" content="width=device-width, initial-scale=1">, mobile browsers pretend to be a desktop and shrink the page, producing the tiny, pinch-to-zoom experience of the pre-smartphone web.
  • Modern layout systems. Flexbox and CSS Grid describe relationships between elements (“these cards should wrap, each at least 18em wide”) rather than fixed positions, so most adaptation happens automatically before a media query is needed.

The alternative approach, serving a separate mobile site on a subdomain such as m.example.com, requires maintaining two versions of every page, redirecting users between them and telling search engines how they relate. Responsive design avoids all of that with a single URL per page.

Why it matters beyond appearance

Search. Google indexes the mobile version of a site first and treats mobile usability as a ranking factor. A page whose text is unreadable without zooming, or whose buttons are too small to tap, is penalised.

Accessibility. Responsive sites tend to cope well when users increase their default font size or zoom to 200 percent, because the layout is already designed to reflow. Fixed layouts break in the same way at high zoom as they do on small screens.

Maintenance. One codebase, one set of content, one set of URLs. Changes are made once and appear everywhere.

Performance. Responsive images and conditional loading mean small devices receive smaller resources, which matters on mobile networks where latency and data caps are real constraints.

Common mistakes

  • Designing only for two sizes, “phone” and “desktop”, and ignoring everything between. Layouts should be checked continuously as the window resizes.
  • Hiding content on mobile instead of reorganising it. Visitors on phones want the same information; hiding it frustrates them and confuses search engines.
  • Serving full-size images to every device.
  • Tap targets that are too small or too close together. Guidelines suggest at least 44 by 44 CSS pixels with space between.
  • Tables that overflow the screen with no horizontal scroll or stacked alternative.
  • Fixed-height elements that clip text when the user’s font size is larger than the designer’s.

Testing a site on real screen sizes

  • Start from the smallest screen and add complexity as space allows; it is easier to expand a simple layout than to squeeze a complex one.
  • Use relative units for typography and spacing so that user preferences are respected.
  • Test on real devices as well as in the browser’s device emulator; touch, scrolling and performance differ.
  • Run the page through a mobile-friendliness or Lighthouse check and fix the reported tap-target and viewport issues.
  • Reserve space for images and embeds so the layout does not jump as they load.

Frequently asked questions

Is responsive design the same as mobile-first?

Mobile-first is a way of practising responsive design: write the base styles for small screens and use media queries to add larger layouts. Responsive design describes the goal; mobile-first describes an order of work.

Do I need a separate app instead?

Only if you need capabilities the web cannot offer on your target platforms. For content and most services, a responsive site reaches every device without an app store and can be installed as a progressive web app where that helps.

Why does a site look fine on my phone but broken on a tablet?

Usually because the designers tested at phone and desktop widths only, and the tablet falls into an untested range where a media query has not yet switched layouts.

Responsive design treats screen size as a range to be handled, not a set of fixed targets to hit.

In short: Responsive design lets one set of pages adapt to any screen through fluid layouts, media queries and flexible media. It keeps URLs and content consistent, helps search visibility and accessibility, and costs less to maintain than separate versions of a site.