Preferences

Privacy is important to us, so you have the option of disabling certain types of storage that may not be necessary for the basic functioning of the website. Blocking categories may impact your experience on the website. More information (Cookie Policy)

Responsive Design: What It Is and How to Build It

Responsive design is an approach where one page adapts its layout to any screen size. Learn the CSS techniques, the viewport tag and how to test it.

Sorank customerSorank customerThomas Girauc, Sorank customerCelio Fabiano, Sorank customerSorank customerXavier Breull, Sorank customer
+ 9'000 Subscribers
Responsive Design: What It Is and How to Build It
Notification: your site reached 20K clicks from Google Search in 28 days

Tools

On this page

Summary

Responsive design is a way to build a website so that one set of HTML and CSS adapts its layout to any screen size, from a phone to a desktop monitor. Instead of building separate mobile and desktop sites, the page uses fluid grids, flexible images and media queries to rearrange its content as the screen changes.

Want to go further? Ask

Responsive design is the layout approach Google recommends for mobile-friendly sites. The same URL serves the same HTML on every device, and CSS decides how that content is arranged. A menu can become a row of links on a laptop and a single button on a phone, with no second site to maintain. The term was coined by Ethan Marcotte in 2010, as MDN Web Docs explains.

How does responsive design work?

It rests on three building blocks. Each one solves a different part of the layout problem, and most real sites use all three together.

  • Fluid grids use percentages, Flexbox or CSS Grid, so columns stretch and shrink with the screen instead of keeping fixed pixel widths.
  • Flexible images shrink to fit their container, so a large photo never pushes the page into sideways scrolling.
  • Media queries apply different CSS rules at different screen widths, so a three-column layout can become one column on a phone.

Together they let one stylesheet handle every screen. You do not need a separate template for each device, and you can change the layout later by editing the CSS once.

Why does the viewport meta tag matter?

Mobile browsers need one line of HTML to use the real width of the phone. Without it, many browsers draw the page at a desktop width and shrink it to fit, so your media queries may never trigger. The web.dev guide to responsive design basics recommends including this tag on every page.

<meta name="viewport" content="width=device-width, initial-scale=1">
Page of the web.dev guide to responsive design basics, with its advice on the viewport tag and flexible layouts
Screenshot of web.dev

Tip

Check the layout on a real phone when you can. Browser emulators help, but they do not always show how a phone handles zoom and touch.

How do media queries and breakpoints work?

A media query checks a condition, most often the width of the browser window, and applies CSS only when that condition is true. The width where the layout changes is called a breakpoint. MDN Web Docs recommends a mobile-first approach: write the single-column layout first, then add columns at wider breakpoints.

.wrapper {
  display: block;
}

@media screen and (width >= 600px) {
  .wrapper {
    display: flex;
  }
}

Define breakpoints in relative units such as rem or em where you can, so text size and spacing follow the reader's settings. Media queries are not always required, since flexible grids and min or max values can handle many layouts on their own.

MDN Web Docs page on responsive design, with its media query and fluid layout explanations
Screenshot of developer.mozilla.org

Which CSS techniques make a layout responsive?

Most responsive layouts combine the techniques below. Pick the one that fits the job, not the one that is newest.

TechniqueWhat it controlsTypical use
FlexboxItems in one row or one columnNavigation bars, rows of cards
CSS GridRows and columns togetherPage layouts, galleries
Media queriesRules that change at a given widthSwitching from one column to three
Relative units (%, rem, em)Sizes that scale with the text or the containerWidths, spacing, font sizes
max-width: 100%Stops images and videos from overflowingPhotos, embedded videos

How do you make images responsive?

Set max-width: 100% on images, videos and embeds, so they shrink to fit but never grow beyond their container. Also set the width and height attributes, so the browser reserves the space before the file loads. This reduces layout shifts, which are part of Core Web Vitals, the speed and stability scores Google uses to judge page experience.

img,
picture,
video {
  max-width: 100%;
  height: auto;
}

For large photos, image optimization covers the file formats and sizes that keep phones fast. To serve a smaller file to small screens, MDN describes the srcset and sizes attributes.

How does responsive design affect SEO?

Google Search Central describes responsive design as serving the same HTML on the same URL to every device, while the content can be displayed differently based on screen size. It also says Google recommends this setup because it is the easiest design pattern to implement and maintain. Under mobile-first indexing, Google uses the mobile version of your content as the main version for indexing, so a page that breaks on phones can lose ground even in desktop results.

Speed belongs in the same review. Heavy images and scripts slow a page down most on phones, so check your page speed alongside the layout.

How do you test a responsive design?

Test on at least two screen sizes, then check speed for both. The steps below cover the checks that matter most.

  1. Open the page on a phone-size screen and on a laptop. Check the menu, the text size and the buttons.
  2. Resize the browser window slowly from wide to narrow. Look for the point where text, an image or a button is cut off or forces sideways scrolling.
  3. Check the viewport tag in the page source, then confirm that pinch-to-zoom still works on a phone.
  4. Measure mobile and desktop speed and Core Web Vitals. The free Sorank Chrome extension shows mobile and desktop performance and Core Web Vitals for any page in one click. For a line-by-line report, read how to read PageSpeed Insights.

Common responsive design mistakes

These four errors show up often. Check for each one before you publish.

Missing viewport tag

The page has no viewport meta tag, so a phone shows a zoomed-out desktop layout with tiny text. You spot it when media queries never change anything on a phone. Fix it by adding the tag from the viewport section to the head of every template.

Fixed pixel widths

Containers, tables or images have a set width, such as 900px. You spot it when a horizontal scrollbar appears on a phone. Fix it with percentages, max-width or a fluid grid, so the element can shrink.

Zoom blocked by the viewport tag

The tag includes maximum-scale, minimum-scale or user-scalable. You spot it when pinch-to-zoom does nothing on a phone. Fix it by removing those parameters, because web.dev advises against them: they can block zooming and hurt accessibility.

Text sized only in viewport units

Font sizes use only a unit such as vw, so the text does not scale well when the reader zooms. You spot it by enlarging the text in your browser and seeing that the layout breaks or the text barely grows. Fix it by combining a fixed unit with a viewport unit, for example calc(1.5rem + 4vw), as MDN suggests.

Why does responsive design matter for SEO and GEO?

A responsive page has one URL and one HTML version, so there is one page to write, check and maintain. Search engines read the same content that visitors see, and that keeps your message consistent across devices. Because Google indexes the mobile version of your content, the layout that works on a phone is the one that counts. For the ranking side of phones, read the Mobile SEO guide to ranking on smartphones. This page covers the layout code, while that guide covers search results. If you want the bigger picture, the user experience entry explains how layout ties into rankings and AI visibility.

Conclusion

Responsive design gives you one page that works on every screen, built with fluid grids, flexible images, media queries and a viewport tag. Start with the viewport tag, then test your main templates on a phone and a laptop. Fix fixed widths and blocked zoom first, because those cause the most visible damage.

Sources

Frequently asked questions

Is responsive design the same as being mobile-friendly?

Not quite. Responsive design is one way to be mobile-friendly, and it is the approach Google recommends. A responsive layout works well on a phone without requiring a second site to maintain.

Do I need a viewport meta tag for responsive design?

Yes. Without it, many phones show the page at desktop width and zoom it out, so your media queries may never run. Add width=device-width and initial-scale=1 in the head of every page.

Does responsive design help my SEO directly?

It helps indirectly. Google recommends responsive design, and under mobile-first indexing it uses the mobile version of your content to index and rank pages. A layout that works on phones protects the version Google reads.

Our Blog for Ambitious Company

Testimonials from ambitious founders

0 to 10000 visitors in 5 months

Celio Fabianomonrobotlavevitre.frGoogleE-commerce

0 to 5000 visits in 8 months

Thibault BMsorank.comGoogleSoftware

0 to 1104 clicks in 4 months

Dominiqueflight-sensations-idf.comGoogleLeisure and aviation

0 to 163 clicks in 6 months

Coworking Pariscoworking-paris.frGoogleOffice broker

x92 clicks in 7 months

Guide Zanzibarguidezanzibar.comGoogleTravel