Key takeaway
- Learn how responsive web design works, from the viewport tag and media queries to container queries, and adopt a repeatable workflow for front-end teams.
Responsive web design (RWD) is an approach, not a separate technology, that makes web pages render well on all screen sizes and resolutions while keeping them usable. MDN describes it in exactly those terms. In practice, one codebase serves phones, tablets, laptops and large monitors, using a viewport meta tag, flexible layouts, flexible media and CSS media queries, and now container queries for components.
For enterprise leaders and front-end architects, the decision is less about whether to be responsive and more about how to keep it reliable as sites grow: which breakpoints you support, how components adapt, and how layout is tested. This guide explains how responsive design works and sets out a workflow your team can adopt. For the wider design context, see our guide to user experience design tools and principles.
What is responsive web design?
Responsive web design is a way of building pages so that the same HTML and CSS adapt to the device that displays them. MDN states that it is an approach and not a separate technology, which means there is no single feature to switch on. You combine a small set of techniques: a viewport declaration, fluid layout, flexible images and video, and conditional styles.
The alternative is to build and maintain a separate version of the site for each class of device. Responsive design avoids that duplication, so a content change or a bug fix is made once. That is the main reason it remains the default for marketing sites, documentation portals and most customer-facing web applications.
How does responsive design work?
Responsive layouts rest on three long-standing ingredients, fluid layout, flexible media and media queries, plus one newer addition, container queries. Each one is explained below with the details MDN documents.

Why does every page need the viewport meta tag?
Mobile browsers need to be told to use the width of the device as the width of the page. MDN recommends this tag in the head of every document: <meta name="viewport" content="width=device-width" />. Its guidance is to always include it. Without it, a mobile browser may lay the page out as if on a wide desktop screen and shrink it, and your media queries will not behave as you expect.
How do fluid layouts work?
A fluid layout sizes columns and containers relative to their parent or to the viewport instead of fixing them in pixels. CSS Grid and Flexbox are the usual tools, and MDN's examples use flexible units such as percentages and fr. The benefit is that the layout keeps working between your breakpoints, not only at the exact widths you tested.
How should images and video adapt?
MDN describes fluid images as images whose max-width is set to 100%, and gives this rule for media elements: img, picture, video { max-width: 100%; }. This scales them down so they never overflow their container. For serving different image files to different screens, MDN points to the srcset and sizes attributes and treats them in its separate responsive images guide, so read that guide before choosing image sizes.
How do media queries and breakpoints work?
A media query runs a test, for example whether the screen is wider than a set value, and applies a block of CSS only when the test passes. The points where the layout changes are called breakpoints. MDN's examples use the range syntax, such as @media (width >= 1200px) { ... }.
Two practices from MDN are worth making team standards. First, define breakpoints in relative units such as em or rem rather than in sizes tied to an individual device. Second, consider mobile-first design: write a simple single-column layout for narrow screens, then add multi-column layouts as the screen gets wider.
Which CSS units suit responsive design?
| Unit | What it is relative to | Where it fits |
|---|---|---|
% | The parent element | Fluid widths of columns and containers |
em | The font size of the element's parent context | Breakpoints and spacing that scale with text size |
rem | The font size of the root element | Consistent type scale and breakpoints |
vw | 1% of the viewport width | Large layout elements; do not size text with it alone |
fr | A share of free space in a grid | Flexible grid columns |
On text, MDN is explicit: never set text using viewport units alone, because the text will not respond to user zoom settings. It suggests combining units, for example calc(1.5rem + 4vw).
What are container queries and when do you need them?
Media queries respond to the viewport. Container queries respond to the size of a parent element, which suits reusable components that appear in a wide main column in one place and a narrow sidebar in another. You declare a container with container-type (for example inline-size) and, optionally, container-name, then write an @container rule such as @container (width > 700px) { ... }. MDN also documents container query length units such as cqw, cqi and cqb. MDN's page does not state browser support, so check the current support tables before relying on them. For older browsers, it suggests a fallback based on display: grid and a media query.
Which responsive technique fits which problem?
| Technique | What it solves | When it fits | Watch out for |
|---|---|---|---|
| Viewport meta tag | Mobile browsers using the wrong page width | Every page, always | Missing from templates and landing pages built by other teams |
| Fluid grid (Grid, Flexbox) | Layout that holds between breakpoints | Page-level structure | Fixed pixel widths creeping back in |
max-width: 100% on media | Images and video overflowing their container | All content media | Does not choose a smaller file; use srcset and sizes for that |
| Media queries | Layout changes by viewport width | Page-level breakpoints | Breakpoints tied to specific devices rather than content |
| Container queries | Components that must adapt to the space they are given | Design systems and reusable cards, widgets, panels | Confirm browser support; keep a media query fallback |
What does a responsive design workflow look like?
A workflow turns the techniques above into something a team can repeat and review. A practical sequence is:
- Set the viewport meta tag in the shared page template so no page can ship without it.
- Write the base styles for the narrowest layout first, then add wider layouts with media queries (mobile first).
- Choose breakpoints where the content starts to look wrong, and write them in relative units.
- Build reusable components with container queries where they appear in different-width slots, and keep a media query fallback if you support older browsers.
- Test layout across a range of widths and orientations, not only at your breakpoints. Automated layout checks help here; our guide to responsive design testing with the Galen framework shows one open-source approach.
- Review at the design-system level, so a fix to one component reaches every page that uses it.
What are the trade-offs, and when is responsive design not enough?
- Complexity grows with the number of breakpoints. Every extra layout is another state to test. Fewer, content-driven breakpoints are easier to keep correct.
- Responsive does not mean fast. A single layout that scales still ships whatever images and scripts you give it. Responsive images and performance budgets are separate work.
- Text and zoom. Sizing text with viewport units alone breaks user zoom, as MDN warns.
- Task-specific mobile experiences. Where a mobile task is very different from the desktop one, such as a field-service app, a dedicated mobile interface may serve users better than one adapted layout. That is a judgement call for your product, not a rule from the standards.
If your interface is conversational rather than page-based, the layout questions change; see our guide to conversational user interface best practices.
How do AI coding agents change responsive front-end work?
Teams increasingly ask AI agents to draft components and page layouts. That makes your responsive rules more important, not less: an agent can only follow standards such as "viewport tag in the template, mobile first, relative-unit breakpoints, container queries for components" if they are written down and checked in review or in the pipeline. This is a practical point, not a measured finding. Platforms such as ElixirClaw, an agentic OS platform to build, orchestrate and govern AI agents and automation workflows while keeping humans in control, and ElixirData Context OS, which keeps governed context, versioned policy and decision traces in one decision layer above AI agents, address that governance side for agent-driven delivery in general.
To map one front-end delivery decision your agents should make, and the context and policy it depends on, book a Context Workshop. See what happens in the workshop.
Frequently asked questions
What is responsive web design in one sentence?
It is an approach, not a separate technology, that makes web pages render well on all screen sizes and resolutions while ensuring good usability, according to MDN.
Do I always need the viewport meta tag?
Yes. MDN says to always include <meta name="viewport" content="width=device-width" /> in the head of your documents, so mobile browsers set the viewport width to the device width.
What is the difference between media queries and container queries?
Media queries test the viewport, for example its width. Container queries test the size of a parent element declared with container-type, so a component can adapt to the space it is given. Check current browser support before relying on container queries.
What is mobile-first design?
It means writing a simple single-column layout for narrow screens first, then using media queries to add multi-column layouts for wider screens, as MDN describes.
Which units should I use for breakpoints and text?
MDN recommends defining breakpoints in relative units rather than sizes tied to a device, and warns against setting text with viewport units alone because it will not respond to zoom; combine them, for example with calc().
Follow XenonStack on LinkedIn: XenonStack on LinkedIn for new guides on agentic AI, data and platform engineering.
Explore the XenonStack platform family: ElixirData · ElixirClaw · ElixirHub · NexaStack · MetaSecure · Neural AI · AgentGRC · AgentSRE · AgentAnalyst · AgentInstruct · AgentRAI · AgentScrum · AgentSearch · AgentForce · AI Aviator · SAIF Aviator · CohortIQ · XenonStack AI · XenonStack UAE