Why Responsive Design is More Than Just Media Queries
"Responsive design is not about adding more media queries. It is about building flexible layouts that adapt naturally to every screen size."
If you write CSS for the frontend, you have almost certainly written a media query. It usually looks something like this:
@media (max-width: 768px) {
.card {
width: 100%;
}
}
Media queries are undeniably one of the most important tools available for building responsive websites. They are also one of the most frequently misunderstood.
The key point is this:
Responsive design is not simply the act of writing media queries.
A website can contain ten, twenty, or even fifty media queries and still deliver a poor experience on a phone.
This article examines responsive design from a practical frontend perspective: what it actually means, why it matters, and which techniques complement media queries to produce layouts that adapt naturally.
What Does Responsive Design Actually Mean?
In practical terms, responsive design means the following:
A website should adapt its layout and content to the available screen space and to the device being used.
Consider a page that displays like this on a desktop:
---------------------------------------------------------
| Logo Home About Products Contact |
---------------------------------------------------------
| Card 1 | Card 2 | Card 3 |
| | | |
---------------------------------------------------------
On a wide desktop viewport, three cards in a single row may look appropriate. On a mobile screen, however, the same layout does not work:
-----------------------
| Logo Menu |
-----------------------
| Card 1 |
| Card 2 |
| Card 3 |
Notice that we are not simply scaling everything down.
We are restructuring the layout to suit the available space. That distinction is the core of responsive design.
Why Is Responsive Design Important?
Most users browse websites, purchase products, read articles, complete forms, and use web applications on smartphones. Google also relies on mobile-first indexing for the majority of websites, which means the mobile version of a page is the primary version used for indexing and evaluation.
Building exclusively for a 1920px desktop monitor is therefore no longer sufficient. A modern layout must account for:
- Mobile phones
- Tablets
- Laptops
- Desktop monitors
- Varying screen orientations
This is where responsive design becomes essential.
First, Let's Talk About Breakpoints
Before writing media queries, developers must decide when the layout should change. For example:
- Three cards on desktop
- Two cards on tablet
- One card on mobile
These thresholds are called breakpoints.
If you work with Bootstrap, you are probably familiar with its default breakpoints:
Extra small < 576px
Small >= 576px
Medium >= 768px
Large >= 992px
Extra large >= 1200px
Extra extra large >= 1400px
These are the default breakpoints in Bootstrap 5. One important clarification:
These values are not universal device sizes.
CSS does not assume that every phone is exactly 576px wide, or that every tablet is exactly 768px wide.
A breakpoint should be chosen based on when the layout needs to change, rather than on the assumption that it corresponds to a specific device:
"This is the iPhone breakpoint."
If your navigation begins to break at 850px, you need a breakpoint near that width, regardless of which devices happen to match it.
Now Let's Talk About Media Queries
Media queries apply CSS conditionally, based on characteristics such as the viewport width. A simple example:
@media (max-width: 767px) {
.card {
width: 100%;
}
}
When the viewport is 767px or narrower, the card expands to fill the available width.
Conditions can also be combined:
@media (min-width: 768px) and (max-width: 991px) {
.card {
width: 50%;
}
}
This is useful when tablet and desktop sizes require distinctly different behaviour.
Media Queries Are Only One Piece of Responsive Design
Imagine you are building a product page and you write:
@media (max-width: 768px) {
.product-card {
width: 100%;
}
}
The card now becomes full width on smaller screens, which appears to solve the problem. However, several issues quickly become apparent:
- The heading is too large.
- The image overflows its container.
- The button tap target is too small.
- The text wraps at awkward points.
- The card has a fixed height, causing content to overflow.
Each of these could be addressed with another media query, but the result tends to look like this:
@media (...) { }
@media (...) { }
@media (...) { }
@media (...) { }
@media (...) { }
@media (...) { }
This is how responsive design becomes unnecessarily complicated.
Rather than repeatedly asking "Which media query should I add?", a more effective question is:
"Can the layout be made flexible enough to adapt on its own?"
That is where the following CSS techniques become valuable.
Use Fluid Widths
One of the simplest improvements is replacing fixed widths with relative ones. Instead of:
.container {
width: 1200px;
}
Use:
.container {
width: 90%;
max-width: 1200px;
margin: 0 auto;
}
The container can now shrink on smaller viewports while still capping its width on large screens. Relative units such as percentages and rem, combined with Flexbox and Grid, further reduce the need for manual breakpoints.
It is a small change, but it can meaningfully reduce the number of media queries a project requires.
CSS Frameworks: Because Deadlines Exist
In production work, we rarely write every line of responsive CSS from scratch. CSS frameworks are valuable in exactly this context.
Two widely used examples are Bootstrap and Tailwind CSS.
Having worked extensively with Bootstrap, one of its main advantages is the availability of pre-built responsive utilities and components. These provide:
- A responsive grid system
- Utility classes for spacing, display, and alignment
- Components such as navbars, modals, and cards that already handle their own breakpoints
If you need a navigation bar, Bootstrap provides a responsive navbar component out of the box. Rather than spending time building one from scratch, you can focus on the project itself. This is a significant part of why frameworks are so widely used in production.
Tailwind CSS takes a different, utility-first approach, but it likewise offers responsive variants that apply styles at specific breakpoints.
Frameworks do not solve every responsive problem.
Projects with highly custom designs may not match a framework's defaults. Even so, frameworks reliably reduce the volume of repetitive CSS a team has to write and maintain.
How Do I Test a Responsive Website?
After making responsive changes, I typically open the browser's developer tools.
In Chrome, the Toggle Device Toolbar allows you to simulate a range of viewport sizes.
Developer tools are indispensable, but there is a limit to what they can verify:
A simulated phone is still a browser pretending to be a phone.
The browser can simulate a viewport, but it cannot fully reproduce touch interaction, scrolling behaviour, font rendering, device performance, or orientation changes.
For that reason, I always test on a real device before shipping. There is no substitute for loading the finished page on an actual phone, where issues such as an unexpected horizontal scrollbar become immediately apparent.
Try It Yourself
Take a page or component you have already built and make it responsive using CSS media queries.
Begin with the desktop layout, then gradually reduce the browser width. At each stage, ask:
- What needs to change on smaller screens?
- Should the width, font size, or spacing adjust?
- Should the layout shift from rows to columns?
If the layout looks broken at first, that is expected. Responsive design is learned through experimentation: breaking things, fixing them, and occasionally staring at your CSS wondering where a particular margin came from.
Open your code editor, pick a component, resize the browser, and see how well your CSS holds up.
Conclusion
If you have read this far, you have now worked through the full set of considerations that responsive design involves beyond media queries.
And if your layout is still not responsive after all of this, that is normal. Most frontend developers are familiar with the following sequence:
1. It doesn't work.
|
v
2. Add CSS.
|
v
3. It works on my laptop.
|
v
4. Open it on mobile.
|
v
5. "What happened here?"
We have all been through it.
So the next time you are making a layout responsive, resist the urge to keep adding media queries until the page finally behaves. Step back and ask a more useful question:
"Is the real problem the breakpoint, or is the CSS itself unnecessarily rigid?"
If you found this article useful, or recognised one of these situations from your own work, feel free to share your thoughts.
If you have a question, run into an issue, or would like to discuss an idea, you are welcome to reach out. I am always happy to connect and help where I can.