SlideShare a Scribd company logo
1 of 32
Responsive Drupal:
Beyond the Media Query
BADCamp 2011




Chris Ruppel
BADCamp 2011 - http://j.mp/badcamp-responsive
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 monitor


The oldest responsive site: http://j.mp/og-responsive
What’s the Problem?
 ‣   Now we deal with these:




Credits: Aaron Stanush
‣   Not to mention these:




Credits: http://j.mp/rethink-mobile
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
       ‣   ...boo


Credits: http://en.wikipedia.org/wiki/Mobile_operating_system
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 :)
Go Responsive
‣ Ask   every device what it needs
‣ Ask   every device what it can do
‣ Avoid   server-side solutions hacks
CSS Media Queries
 ‣ The        spec
   w3.org/TR/css3-mediaqueries

 ‣ The        buzz
   j.mp/ala-rwd

 ‣ The        hotness
   mediaqueri.es


<plug> or check out fourkitchens.com </plug>
Basic Example
<link rel=”stylesheet” href=”this.css”
 media=”all”>
Basic Example
<link rel=”stylesheet” href=”this.css”
 media=”all and (min-width: 960px)”>
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!
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!
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
Mobile First
‣ aka   Progressive Enhancement

‣   Read, re-read, and bookmark (game changer)
    j.mp/rethink-mobile
j.mp/rethink-mobile
Progressive CSS
 ‣ No      media query is a media query
 ‣ Target             the least capable browser first
 ‣ Add        functionality from there
 ‣ More         robust than “graceful degradation”



j.mp/rethink-mobile
Feature Detection
your new religion
Feature Detection
 ‣ Not       just limited to screen size
 ‣ Test        for specific features
 ‣ More          robust than user-agent detection




Learn more: modernizr.com
Feature Detection
‣ Stop    relying on nosey servers


‣ Start   relying on honest browsers
Helper Modules
‣   Responsive Images
    drupal.org/project/responsive_images


‣   Force module CSS into mobile-first approach
    drupal.org/project/responder
Script Loaders
‣ Modernizr:      drupal.org/project/modernizr
‣   Feature detection and asset loading

‣ LABjs:    drupal.org/project/labjs
‣   Use an asynchronous loader for your JS
Drupal Themes
 ‣ AdaptiveTheme
   drupal.org/project/adaptivetheme

 ‣ Omega
   drupal.org/project/omega

 ‣ Zen
   drupal.org/project/zen



http://groups.drupal.org/node/175234
Polyfills
‣ Respond.js   - For IncapablE browsers
 github.com/scottjehl/Respond



‣ Adapt.js   - JS alternative to MQs
 github.com/nathansmith/adapt
Responsive Media
‣ Responsive    videos via jQuery
 fitvidsjs.com



‣ Responsive    slideshows
 marktyrrell.com/labs/blueberry
Front-end Performance
‣ Up  to 97% of perceived mobile
   response time depends on front-end
‣ Your  super-stack cannot fix slow
   requests.



http://www.webperformancetoday.com/2011/04/20/
desktop-vs-mobile-web-page-load-speed/
Front-end Performance
‣ CacheHTML, internal and external if
 possible
‣ Optimize   CSS/JS, reduce number of
 requests
Front-end Performance
 ‣ Print   JS last in your templates
 ‣ Experiment  with responsive images,
   data URIs, and/or sprites




Credits
Check your work
‣   http://stevesouders.com/mobileperf/
    Super-awesome tools for testing on mobile devices.
    Ranges from quick test to intense debugging

‣   http://jdrop.org
    Easily collect mobile performance data and analyze on your desktop

‣   http://blaze.io/mobile
    Test regional bandwidth, provides waterfalls and screenshots
Always remember...
 ‣   There is no single best practice.
 ‣   We’re not sure what’s next.




Credits: http://futurefriend.ly
Thank You!
chris@fourkitchens.com
twitter.com/rupl
drupal.org/user/411999




BADCamp 2011 - http://j.mp/badcamp-responsive
All content in this presentation, except where noted otherwise, is Creative Commons Attribution-
ShareAlike 3.0 licensed and copyright 2011 Four Kitchens, LLC.

More Related Content

Recently uploaded

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 

Recently uploaded (20)

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Responsive Drupal: Beyond the Media Query

  • 1. Responsive Drupal: Beyond the Media Query BADCamp 2011 Chris Ruppel BADCamp 2011 - http://j.mp/badcamp-responsive
  • 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 monitor The oldest responsive site: http://j.mp/og-responsive
  • 3. What’s the Problem? ‣ Now we deal with these: Credits: Aaron Stanush
  • 4. Not to mention these: Credits: http://j.mp/rethink-mobile
  • 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 ‣ ...boo Credits: http://en.wikipedia.org/wiki/Mobile_operating_system
  • 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. Go Responsive ‣ Ask every device what it needs ‣ Ask every device what it can do ‣ Avoid server-side solutions hacks
  • 8. CSS Media Queries ‣ The spec w3.org/TR/css3-mediaqueries ‣ The buzz j.mp/ala-rwd ‣ The hotness mediaqueri.es <plug> or check out fourkitchens.com </plug>
  • 9. Basic Example <link rel=”stylesheet” href=”this.css” media=”all”>
  • 10. Basic Example <link rel=”stylesheet” href=”this.css” media=”all and (min-width: 960px)”>
  • 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. 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. 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. Mobile First ‣ aka Progressive Enhancement ‣ Read, re-read, and bookmark (game changer) j.mp/rethink-mobile
  • 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” j.mp/rethink-mobile
  • 18. Feature Detection ‣ Not just limited to screen size ‣ Test for specific features ‣ More robust than user-agent detection Learn more: modernizr.com
  • 19. Feature Detection ‣ Stop relying on nosey servers ‣ Start relying on honest browsers
  • 20. Helper Modules ‣ Responsive Images drupal.org/project/responsive_images ‣ Force module CSS into mobile-first approach drupal.org/project/responder
  • 21. Script Loaders ‣ Modernizr: drupal.org/project/modernizr ‣ Feature detection and asset loading ‣ LABjs: drupal.org/project/labjs ‣ Use an asynchronous loader for your JS
  • 22. Drupal Themes ‣ AdaptiveTheme drupal.org/project/adaptivetheme ‣ Omega drupal.org/project/omega ‣ Zen drupal.org/project/zen http://groups.drupal.org/node/175234
  • 23. Polyfills ‣ Respond.js - For IncapablE browsers github.com/scottjehl/Respond ‣ Adapt.js - JS alternative to MQs github.com/nathansmith/adapt
  • 24. Responsive Media ‣ Responsive videos via jQuery fitvidsjs.com ‣ Responsive slideshows marktyrrell.com/labs/blueberry
  • 25.
  • 26. Front-end Performance ‣ Up to 97% of perceived mobile response time depends on front-end ‣ Your super-stack cannot fix slow requests. http://www.webperformancetoday.com/2011/04/20/ desktop-vs-mobile-web-page-load-speed/
  • 27. Front-end Performance ‣ CacheHTML, internal and external if possible ‣ Optimize CSS/JS, reduce number of requests
  • 28. Front-end Performance ‣ Print JS last in your templates ‣ Experiment with responsive images, data URIs, and/or sprites Credits
  • 29. Check your work ‣ http://stevesouders.com/mobileperf/ Super-awesome tools for testing on mobile devices. Ranges from quick test to intense debugging ‣ http://jdrop.org Easily collect mobile performance data and analyze on your desktop ‣ http://blaze.io/mobile Test regional bandwidth, provides waterfalls and screenshots
  • 30. Always remember... ‣ There is no single best practice. ‣ We’re not sure what’s next. Credits: http://futurefriend.ly
  • 32. All content in this presentation, except where noted otherwise, is Creative Commons Attribution- ShareAlike 3.0 licensed and copyright 2011 Four Kitchens, LLC.

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n