Your site looks fine on your laptop but cramped on a phone? Responsive web design fixes that: set the viewport tag, use flexible grids and images, then add media queries where the content breaks.
This guide belongs to the wider topic of web page layout, so it focuses on how one design flexes across many screens.
| Item | Value |
|---|---|
| Year Ethan Marcotte coined “responsive design” | 2010 |
| Typical default render width of mobile browsers without a viewport tag | About 980px |
| Recommended viewport meta value | width=device-width, initial-scale=1 |
| Recommended image rule | max-width of 100% |
| Minimum card size in the web.dev grid demo | 200px |
| Example columns on phone, tablet and desktop | One, two, then three or four columns |
These figures come from web.dev’s responsive basics and MDN’s responsive web design guide. Guidance and browser behavior can change, so check the source before you rely on them.
What is responsive web design?
Responsive web design is not a separate technology. MDN describes it as an approach: a set of best practices for building a layout that can respond to whatever device shows the content.
The term was coined by Ethan Marcotte in 2010 and originally combined fluid grids, fluid images and media queries, according to MDN. Modern CSS layout methods are inherently responsive, so much of the work is now built into the platform.
The web.dev basics page gives a simple picture: a responsive site might show a single column on a phone, two columns on a tablet, and three or four columns on a desktop computer. It adds that modern responsive design also accounts for touch screens.
A plain HTML page is already fluid, because the browser reflows text to fit the viewport. The catch is line length: long lines on a wide monitor are hard to read, while a fixed width leads to scroll bars on narrow devices and too much empty space on wide screens. How wide a line of text should run is a typography question, and typography in web design covers that side of the problem.
Set the viewport before anything else
Without a viewport tag, mobile browsers render the page at a desktop width, usually about 980px, and then scale the content to fit. According to web.dev, this can make fonts look inconsistent and force people to zoom in. A page without the tag loads very zoomed out, which makes the text hard to read.
The fix is one meta viewport tag in the head of the document: <meta name=”viewport” content=”width=device-width, initial-scale=1″>. Each part does a job:
- width=device-width makes the page match the screen’s width in device-independent pixels, so content can reflow.
- initial-scale=1 lets the page use the full landscape width when the device rotates, instead of zooming to fill the screen.
- Separate the attributes with a comma so older browsers parse them properly.
Avoid the minimum-scale, maximum-scale and user-scalable attributes. web.dev advises against them because they can stop people zooming, which creates accessibility problems.
Build flexible layouts with flexbox and grid
In the past, flexible layouts meant setting columns in percentages, because pixel measurements forced horizontal scrolling on small screens. web.dev notes that modern CSS layout techniques such as flexbox, grid layout and multicol make creating flexible grids much easier.
The two you will reach for most often:
- Flexbox shows items as a single row, or wraps them onto multiple rows as the available space decreases. It suits items of different sizes.
- CSS grid can place as many items on each row as fit. In the web.dev card demo the minimum size is 200px, and the number of tracks shrinks as the screen narrows.
Because the grid drops columns by itself, a card gallery can adapt without a single media query. Reserve queries for the points where the whole page structure needs to change.

Keep images and content inside the viewport
An image with fixed dimensions makes the page scroll if it is larger than the viewport. web.dev recommends giving all images a max-width of 100%, which shrinks them to fit the available space without stretching them past their original size.
Also add width and height attributes to your img tags. The browser can then reserve space before the image loads, which helps prevent layout shifts.
People expect to scroll vertically, not horizontally. If something overflows, the Lighthouse audit “Content is not sized correctly for the viewport” can help you detect it automatically.
Use media queries and choose breakpoints by content
A media query applies CSS only when the browser and device environment matches a rule you specify. MDN calls them a key part of responsive design, and they can also detect things like whether someone is using a touchscreen rather than a mouse.
The width and height features can be used as ranges. Prefix them with min- or max- to say the value is a minimum or a maximum, and combine conditions with the word “and” when a rule needs more than one test.
Where should the breakpoint go? Per web.dev’s Learn Design course, choose breakpoints based on your content rather than popular device sizes, because device sizes change with every technology release cycle. In its example, 50em is where lines of text become uncomfortably long, so that is where the layout changes.
A sensible workflow looks like this:
- Write base styles for the smallest screen first, a habit explained further under mobile first design.
- Widen the browser slowly and watch for the point where lines get too long or gaps look awkward.
- Add a min-width query at that point and adjust only what needs changing.
- Repeat until the widest layout still reads well.
Check your work before you publish
Lighthouse has an audit that flags pages missing a meta viewport tag with width or initial-scale. Running it, along with the overflow audit, catches the two most common mobile layout mistakes in seconds.
Then run through a short checklist:
- The viewport tag is present and does not disable zooming.
- No page needs horizontal scrolling at any width.
- Every image has width and height attributes plus a flexible max-width.
- Breakpoints sit where the content strains, not at a favorite phone’s width.
- Buttons and links work with a finger as well as a mouse.
Frequently asked questions
Do I still need a viewport tag if my CSS is already flexible?
Show answer
Yes. The tag is what tells the browser to use the real screen width, so your flexible CSS has something accurate to respond to.
Should I base breakpoints on popular phone sizes?
Show answer
It is better not to. Watch where your own content starts to look stretched or squeezed and put the change there; that spot stays valid when new devices arrive.
Is it fine to block pinch zoom so the layout stays tidy?
Show answer
No. Blocking zoom can lock out people who need larger text, and web.dev specifically does not recommend those attributes.
How can I test layouts without owning every device?
Show answer
MDN suggests the responsive sizing features in browser developer tools, such as Firefox Responsive Design Mode, to simulate different device widths.
Do modern layouts still need media queries?
Show answer
Sometimes not. A grid that fits as many items as it can will drop columns on its own as the screen shrinks, so queries are mainly for larger structural changes.



