Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Responsive Drupal: Beyond the Media Query


Published on

My presentation slides from BADCamp 2011. An in-depth discussion about responsive website development, including a brief history of mobile-first responsive design, how you can get started in Drupal, and how you can improve an existing responsive website to make it as performant and fast as possible.

Download PDF of slides here:

Published in: Technology
  • Login to see the comments

Responsive Drupal: Beyond the Media Query

  1. 1. Responsive Drupal:Beyond the Media QueryBADCamp 2011Chris RuppelBADCamp 2011 -
  2. 2. What’s the Problem? ‣ Original web pages were all responsive ‣ As screens got bigger, we got pickier about the look of a site... ‣On the desktop monitorThe oldest responsive site:
  3. 3. What’s the Problem? ‣ Now we deal with these:Credits: Aaron Stanush
  4. 4. ‣ Not to mention these:Credits:
  5. 5. So many browsers ‣ Do you really have time to test for and cater to: ‣ Chrome, Firefox, Safari, Opera, Internet Explorer 6-7-8-9-10, Symbian, iPhone, iPad, Android phones, Android tablets, RIM (Blackberry), Windows CE, Windows mobile, Windows Phone 7, Linux, bada, MeeGo, Brew OS ‣ ...booCredits:
  6. 6. Forget about...‣ User-agent detection + Separate mobile theme‣ Separate subdomain / path + redirection‣ External services‣ These are alternatives, each with strengths and weaknesses. We don’t care about them today :)
  7. 7. Go Responsive‣ Ask every device what it needs‣ Ask every device what it can do‣ Avoid server-side solutions hacks
  8. 8. CSS Media Queries ‣ The spec ‣ The buzz ‣ The hotness<plug> or check out </plug>
  9. 9. Basic Example<link rel=”stylesheet” href=”this.css” media=”all”>
  10. 10. Basic Example<link rel=”stylesheet” href=”this.css” media=”all and (min-width: 960px)”>
  11. 11. Basic Example <link rel=”stylesheet” href=”this.css” media=”all and (min-width: 960px)”> /* This CSS will always apply - global styles */ body {padding: 10px; } #container {width: 100%; margin: 0; }Use care when mixing these two syntaxes!
  12. 12. Basic Example <link rel=”stylesheet” href=”this.css” media=”all and (min-width: 960px)”> /* This CSS will always apply - global styles */ body {padding: 10px; } #container {width: 100%; margin: 0; } /* CSS will only apply when the window is 960px or greater */ @media screen and (min-width: 960px) { body {padding: 0; } #container {width: 960px; margin: 0 auto; } }Use care when mixing these two syntaxes!
  13. 13. cool, but...‣ IE 8 and below do not recognize media queries (weep not, more on this later)‣ Don’tjust pop open your existing stylesheets and wrap them in queries
  14. 14. Mobile First‣ aka Progressive Enhancement‣ Read, re-read, and bookmark (game changer)
  15. 15.
  16. 16. Progressive CSS ‣ No media query is a media query ‣ Target the least capable browser first ‣ Add functionality from there ‣ More robust than “graceful degradation”
  17. 17. Feature Detectionyour new religion
  18. 18. Feature Detection ‣ Not just limited to screen size ‣ Test for specific features ‣ More robust than user-agent detectionLearn more:
  19. 19. Feature Detection‣ Stop relying on nosey servers‣ Start relying on honest browsers
  20. 20. Helper Modules‣ Responsive Images‣ Force module CSS into mobile-first approach
  21. 21. Script Loaders‣ Modernizr:‣ Feature detection and asset loading‣ LABjs:‣ Use an asynchronous loader for your JS
  22. 22. Drupal Themes ‣ AdaptiveTheme ‣ Omega ‣ Zen
  23. 23. Polyfills‣ Respond.js - For IncapablE browsers‣ Adapt.js - JS alternative to MQs
  24. 24. Responsive Media‣ Responsive videos via jQuery‣ Responsive slideshows
  25. 25. Front-end Performance‣ Up to 97% of perceived mobile response time depends on front-end‣ Your super-stack cannot fix slow requests.
  26. 26. Front-end Performance‣ CacheHTML, internal and external if possible‣ Optimize CSS/JS, reduce number of requests
  27. 27. Front-end Performance ‣ Print JS last in your templates ‣ Experiment with responsive images, data URIs, and/or spritesCredits
  28. 28. Check your work‣ Super-awesome tools for testing on mobile devices. Ranges from quick test to intense debugging‣ Easily collect mobile performance data and analyze on your desktop‣ Test regional bandwidth, provides waterfalls and screenshots
  29. 29. Always remember... ‣ There is no single best practice. ‣ We’re not sure what’s next.Credits:
  30. 30. Thank You! 2011 -
  31. 31. All content in this presentation, except where noted otherwise, is Creative Commons Attribution-ShareAlike 3.0 licensed and copyright 2011 Four Kitchens, LLC.