|
|
|
|
|
by gfodor
4894 days ago
|
|
As someone who's been asleep at the switch with regards to responsive design I get the sense that it's, well, hard. Has anyone written about the "responsive design vs forking the website for mobile" tradeoff? If I were to start hacking together a site today I would probably just create two or three completely different layouts and DRY things up as much as I could in code, instead of trying to get the stars to align and get my browser to render the same assets correctly in all browsers. In other words, responsive design seems to bring under the fold a use case that does not exist: physically resizing a browser window from a desktop size to a mobile size and having a page render correctly as you do it. Its a nice trick, but unless you assume the same client is going to need to see the content "respond" to changes in window size, then it seems prudent to take that use case off the list and simplify the implementation around the real use case: a client with a pre-defined browser window size hits a page and renders it, full stop. (with some small flexibility since users on desktop browsers do resize their window by some % occasionally) (Ie, if you focus on this case, simplest solution may be to fork it at render time in code where you have to and keep the CSS/etc straightforward.) |
|
Assuming we're still considering responsive design, if designed from a mobile-first perspective you'd be surprised how clean the code can be to deal with this. Start with minimal resources and most of your content stacked vertically so that it's lightweight and easy to consume on a touch device. Providing you've used relative units (ems in particular) you can scale up for larger screen with super simple media queries that just bump the font-size on body (e.g. body { font-size: 120%; }). You can find an awesome overview of this approach on Trent Walton's site [1]. Compare this with a hacky approach of doing desktop-first - you're loading assets (probably) unnecessarily, hiding chunks of markup to never be displayed, hammering your CSS to fit your desktop peg into a mobile hole. I know this doesn't cover everything, and any sufficiently complex site will require more than just bumping font-size, but honestly it doesn't have to be super difficult and full of horrible workarounds.
Now with the resposnive vs. separate site debate, the way I've always thought of it is responsive site for web sites, separate sites for web apps. Apps are sufficiently complex, with enough interaction that they require fundamental changes in HTML, CSS and JS to adapt to touch devices. Which leads onto the next point, serve a separate version of a web app based on touch/non-touch not window size, as it is the interaction method that should dictate design choices not how small the window is. It might then be wise to adopt a hybrid approach for your touch-specific app, where you scale up/down for larger/smaller touch-based devices.
Note that some of this may change and become significantly simpler with the advent of the Shadow DOM [2] and Flexbox layouts [3]
[1] http://trentwalton.com/2013/01/07/flexible-foundations/
[2] http://www.html5rocks.com/en/tutorials/webcomponents/shadowd...
[3] http://weblog.bocoup.com/dive-into-flexbox/