Responsive Design: Why You’re Doing It Wrong
Responsive design isn’t a fad that arose because of a cool CSS technique, it’s an answer to a problem. Always remember that and constantly ask yourself whether or not you’re really adequately addressing that problem. If you’re using copy and paste to insert your media query breakpoints, your solution might be flawed.
Let’s discuss why media queries exist and how we can leverage them to truly solve the quandary of the ubiquitous web. Let’s talk about why you should let your content determine the breakpoints of a layout, not hypothetical screen sizes.
This article is part of our series on “looking beyond desktop design”, brought to you in partnership with Heart Internet VPS.
The Idea Behind Media Queries
To begin this debate correctly, it’s necessary to discuss why media queries have suddenly become so popular. The answer is of course that “Responsive Design,” a term coined by Ethan Marcotte, is a fantastic way to address an ever-growing problem for web designers.
This “problem” is great for the world as a whole, but a real headache for us. In the past decade, the worldwide web has transformed into something new. It’s no longer bound by the walls that we had previously established. I’ve said this before but it’s worth repeating. While everyone was ranting on and on about how the “mobile web” was going to overtake the traditional one, the revolution that took place was much more drastic: the web became ubiquitous.
At this point in time, we don’t access the web from a single point. We didn’t give up our laptops in favor of smartphones as “experts” predicted. Instead, the web is everywhere we are. It’s not only in our phones and computers, it’s in our tablets, iPods, gaming systems, televisions and even cars.
This trend will only continue as time goes on. Responsive design brings us past a season of creating separate mobile sites and into an era where we develop one site that evolves and adapts to the device that it’s being viewed on. Using media queries, we can present specific CSS to any number of different viewport sizes and make sure that everyone has the best possible experience.
The Problem With Responsive Design
The section above isn’t a semi-historical rant meant to fill space, it’s an important look at the goals that responsive design is meant to achieve. The question then becomes, does it meet these goals? Does responsive design adequately address the problem of ubiquity?
The answer is complicated, at best I can say, “it depends on how you do it.” That’s a confusing statement isn’t it? Responsive design is straightforward: use media queries to serve up custom CSS to different viewport sizes. This is how everyone approaches it right? So how can there be a right and wrong way?
The complexity arises when we begin to discuss a crucial part of this technique: which media queries should I use? Or put a different way, which “breakpoints” should I target for custom CSS? The current popular answer predictably starts with the best “mobile” devices around: the iPhone and iPad (cue angry Android user comments). From these archetypes we establish so-called “generic” smartphone and tablet sizes. Then we move up and address laptops and small desktops and finally large screens. A standard set of media queries, like this one from CSS-Tricks, typically has nine or ten pre-established breakpoints.
To be fair, this system does work to a certain degree. We’ve all seen lots of great responsive sites built using a set similar to Coyier’s above. However, I can’t help but think that this is somehow repeating the same mistake that we made by designing “mobile sites” a few years ago. The entire focus here is on the device viewing the site. Before we even build the site, we have these breakpoints in mind.
But devices change. We’ve already established that the web is being connected to pretty much everything with a power switch, so why are we once again placing so much emphasis on currently common screen sizes? Is there a better alternative? What if we focused on the needs of a specific design instead of a hypothetical device use case? What if we built layouts that simply worked everywhere?
Content Focused Responsive Design
The aforementioned problems with pre-established media queries occurred to me only as I dug in and really started producing responsive work on my own. In theory, the standard suggestions are great but once you apply them to a complex design you’ll discover that those breakpoints don’t always cover it. The problem, as the Boston Globe designers found quickly found out once the site went live, is that issues arise “in the in-between” (for the record, that project is fantastic and any layout issues have largely been addressed). Things get messy when the design is at a size that you didn’t account for and you have to go in and patch the holes after the fact.
My question is, why don’t we start there? Instead of going into a project with a set of devices, and consequently media queries, in mind, why don’t we let the design decide? Every web page layout has a point where the browser size lessens its integrity. Our job as designers, in light of the problem of ubiquity, should be to find that size and account for it, then lather, rinse and repeat until all of the weak points are accounted for.
I say this as an avid Apple fanboy: stop designing websites for the iPhone. Instead, design a website that maintains its integrity as its viewport size is reduced to any feasible state. Do keep specific devices in mind as a guide for your design (example: smaller devices tend to be touch-based, so make links large), but don’t put your blinders on and fail to look at the bigger picture: that your design should look good on any screen.
A New Workflow
So what does a content focused responsive design workflow look like? It’s simpler than you think. Obviously, you need a starting point of some kind. If you want to start mobile and go up, great. If you want to start large and come down, also great. I personally find it very difficult to really dig into a design and do it right if I’m starting at the mobile level, but there are many solid arguments for doing it this way.
Hypothetically, let’s say you started with a large, 1020px wide site. Check it out on the largest screen you can get your hands on and make sure it looks great. Now drag the window and make it smaller until the design gets ugly. There’s your first breakpoint. Set a media query for that point and fix everything that you need to address. Once you’re finished, grab that window and find the next point of ugliness. Repeat these steps until you’re satisfied with the range that you’ve accounted for.
But what about the iPad? What about the Kindle Fire or Samsung’s latest attempt at being relevant? Something magic happens when you follow this workflow. You just made it so that the layout looks good at just about any size. If you did it right, then when you pull it up on your phone or tablet, it’s going to look great.
Layout Only
Keep in mind this discussion refers to layout ratios only. You absolutely don’t get out of testing functionality on different browsers and devices. Responsive design does nothing to account for the fact that different browser engines interpret HTML, CSS and JavaScript differently.
Conclusion
To sum up, media queries and responsive design provide us with an incredibly powerful tool to account for the fact that websites are being viewed by all manner of screens and viewport sizes. However, once we start pegging our designs to a handful of devices, we’re right back where we started. Your goal instead should be to build a layout that’s so versatile that it can handle almost any viewport size thrown at it.
This is all nice in theory, but where’s the example? The jumping off point of this discussion came from a recent attempt of mine to build a responsive image gallery. Check out that article for a look at how a content focused responsive design workflow might look in the wild.