SlideShare a Scribd company logo
1 of 57
Download to read offline
Responsive Web Design
Ben MacNeill
ben.macneill@extension.org

Twitter:
@chillnc

Presentation at:
slideshare.net/chillnc/

Demo files:
extension.org/share/netc/rwd/
This presentation pulls from this excellent book:


Responsive Web Design
       by Ethan Marcotte
What is Responsive
  Web Design?
Flexible, Device-
Independent Design
Single Source
 of Content
Why Responsive Design?


• Designing for specific devices — too many
• Siloed pages: /mobile/page.html	
  — trapped
Three Components

• A flexible grid-based layout
• Flexible images and media
• Media queries (CSS3)
The Grid




     http://grids.heroku.com/
960px page, 60px column, 12 wide with 20px gutter
960px page

940px

620px                 300px

 600px                 280px
Traditional Fixed Grid
#page	
  {
	
   margin:	
  36px	
  auto;
	
   width:	
  960px;
}
Flexible Grid
#page	
  {
	
   margin:	
  36px	
  auto;
	
   width:	
  90%;
}


(90% is somewhat arbitrary)
960px page

940px

620px                     300px

 600px                     280px

 How does 940px
 translate to a flexible width?
 It depends on its container.
Pixels to Percentages

target	
  ÷	
  context	
  =	
  result


#title         #page
 940px         960px           %
940px	
  ÷	
  960px	
  =	
  0.979166666666667



        97.9166666666667%



      target	
  ÷	
  context	
  =	
  result
#page	
  {
	
   margin:	
  36px	
  auto;
	
   width:	
  90%;
}
#title	
  {
	
   width:	
  97.9166666666667%;
	
   //	
  940px	
  ÷	
  960px
}
960px page

 940px

 620px                               300px

   600px                              280px


620px	
  ÷	
  960px	
  =	
  0.645833333333333
300px	
  ÷	
  960px	
  =	
  0.3125
600px	
  ÷	
  620px	
  =	
  0.967741935483871
280px	
  ÷	
  300px	
  =	
  0.933333333333333
End Result: Fluid Grid
Fluid to
a Fault
 (we'll come
 back to this
  problem)
We also need
  Fluid Typography
 body	
  {font-­‐size:	
  100%}


    24px	
  ÷	
  16px	
  =	
  1.5em
  h1	
  {font-­‐size:	
  1.5em}


target	
  ÷	
  context	
  =	
  result
Three Components

• A flexible grid-based layout
• Flexible images and media
• Media queries (CSS3)
Flexible Images
Basic Markup
.image	
  {
  float:	
  right;
  margin-­‐bottom:	
  0.5em;
  margin-­‐left:	
  01.6666666666667%;
  /*	
  10px	
  ÷	
  600px	
  */
  width:	
  50%;	
  /*	
  300px	
  ÷	
  600px	
  */
}


<p	
  class="image">
 <img	
  src="turtle.jpg"	
  />
</p>
img	
  {max-­‐width:	
  100%;}
Flexible
Caveats

• max-width doesn't work in IE6
• Image scaling hiccups in IE7 & FF2
We don’t care
 about IE6.
Is it okay to stop
         caring about IE7?
• IE7 user base (2.3% - 3.5% May 2012)
• Google stopped supporting in Aug 2011
• Facebook began phasing out support in Dec 2011
• Microsoft is discontinuing support in July 2013
• Flexible images work, just somewhat degraded
Three Components

• A flexible grid-based layout
• Flexible images and media
• Media queries (CSS3)
In the Beginning...
               Media Types
<link	
  rel="stylesheet"	
  href="main.css"	
  media="screen"	
  />
<link	
  rel="stylesheet"	
  href="paper.css"	
  media="print"	
  />
<link	
  rel="stylesheet"	
  href="tiny.css"	
  media="handheld"/>



    • Early phones had poor browsers
    • Media Types proved too broad
Media Query
@media	
  screen	
  and	
  (min-­‐width:	
  1024px)	
  {
  body	
  {font-­‐size:	
  100%;}
}

  • Contains two components:
     media type and (query)

  • The query contains a feature and a value
  • Can be placed right in your stylesheet
Short Detour:
Reseting the Viewport
• Modern mobile browsers pretend that web
  pages are desktop-browser size (~900px)
• They render them at that size
• Then shrink the resulting page to fit in the
  device window
Override the Default
    	
  <meta	
  name="viewport"	
  
 content="initial-­‐scale=1.0,	
  
    width=device-­‐width"	
  />


• Makes width of the browser’s viewport
  equal to the width of the device’s screen
Default Viewport   Reset Viewport
     980px             320px
Fluid to
a Fault
 (Remember?
  I said we'd
  come back
     to this
   problem.)


Answer:
Linearize
Need to remove Flexible Widths
#main	
  {
  float:left;
  margin:	
  10px	
  1.041666666666667%;// 10px ÷ 960px
  width:	
  64.5833333333333%; // 620px ÷ 960px
}

#other	
  {
  float:right;
  margin:	
  10px	
  1.041666666666667%;// 10px ÷ 960px
  width:	
  29.1666666666667%; // 280px ÷ 960px
}
Target Tablets and Smaller

@media	
  screen	
  and	
  (max-­‐width:	
  768px)	
  {
   //	
  css	
  goes	
  here
}


    • This rule tells the browser to render the
       enclosed CSS if the viewport is smaller
       than 768px

                                   *The iPad is 768px in portrait orientation
#main	
  {
  float:left;
  margin:	
  10px	
  1.041666666666667%;
  width:	
  64.5833333333333%;	
  }

#other	
  {
  float:right;
  margin:	
  10px	
  1.041666666666667%;
  width:	
  29.1666666666667%;	
  }



 @media	
  screen	
  and	
  (max-­‐width:	
  768px)	
  {
 	
   #main,	
  #other	
  {
 	
   	
   margin:	
  10px;
 	
   	
   width:	
  auto;
 	
   }
 }
Layout Responds to Resizing
   769px           768px
More Linearization
            for Smaller Devices
.image	
  {
  width:	
  50%;
}


@media	
  screen	
  and	
  (max-­‐width:	
  480px)	
  {
	
   .image	
  {
	
   	
   width:	
  auto;
	
   }
}
481px   400px
Going Larger
Design for larger page
@media	
  screen	
  and	
  (min-­‐width:	
  1200px)	
  {...}


Or limit your page size
#page	
  {max-­‐width:1024px}
Media Query Support

   3.5+                               3+



   9.5+                               9+


          *can fill in some gaps with respond.js
Three Components

• A flexible grid-based layout
• Flexible images and media
• Media queries (CSS3)
The Strategy So Far
/*	
  desktop	
  styles	
  for	
  flexible	
  grid	
  and	
  media	
  */
#page	
  {...}
/*	
  media	
  queries	
  targeting	
  different	
  breakpoints	
  */
@media	
  screen	
  and	
  (max-­‐width:	
  768px)	
  {...}

@media	
  screen	
  and	
  (max-­‐width:	
  480px)	
  {...}
Potential Problems
     • Some devices will not understand
        media queries
     • Some mobile devices will not
        have javascript




However, a flexible layout provides a good fallback
Mobile First
• Have your design default to a simple,
  small-screen layout (very linear)
• Progressively enhance the design using media
  queries as the viewport resolution increases
• If a browser lacks media query support (and
  javascript isn't available as a fix), they get the
  attractive, single-column layout
The Revised Strategy
/*	
  default,	
  linear	
  layout	
  */
#page	
  {
 width:	
  auto;
 max-­‐width:	
  700px;
 }
/*	
  media	
  queries	
  build	
  a	
  flexible	
  layout	
  and	
  enhance	
  at	
  
different	
  breakpoints	
  */
@media	
  screen	
  and	
  (min-­‐width:	
  600px)	
  {...}
@media	
  screen	
  and	
  (min-­‐width:	
  860px)	
  {...}
@media	
  screen	
  and	
  (min-­‐width:	
  1024px)	
  {...}
Final Result:
Mobile First Responsive Design




     example: http://ethanmarcotte.com/
Common Breakpoints
320 pixels    For small screen devices, like phones, held in portrait mode.


480 pixels    For small screen devices, like phones, held in landscape mode.


              Smaller tablets, like the Amazon Kindle (600×800) and Barnes &
600 pixels    Noble Nook (600×1024), held in portrait mode.


768 pixels    Ten-inch tablets like the iPad (768×1024) held in portrait mode.


              Tablets like the iPad (1024×768) held in landscape mode, as well as
1024 pixels   certain laptop, netbook, and desktop displays.


1200 pixels   For widescreen displays, primarily laptop and desktop browsers.
Awesome RWD Examples
•       http://responsivewebdesign.com/robot/

•       http://letsembark.com/

•       http://cognition.happycog.com/



                                    More Reading
    •    Responsive Web Design – Ideas, Technology, and Examples
         http://www.onextrapixel.com/2012/05/17/responsive-web-design-ideas-technology-and-examples/


    •    Ethan Marcotte's original article
         http://www.alistapart.com/articles/responsive-web-design/


    •    Responsive design – harnessing the power of media queries
         http://googlewebmastercentral.blogspot.co.uk/2012/04/responsive-design-harnessing-power-of.html


    •    Responsive Web Design (The book)
         http://www.abookapart.com/products/responsive-web-design
Thanks!
Ben MacNeill
ben.macneill@extension.org

Twitter:
@chillnc

Presentation at:
slideshare.net/chillnc/

Demo files:
extension.org/share/netc/rwd/

More Related Content

Viewers also liked

Google Analytics: Q&A
Google Analytics: Q&AGoogle Analytics: Q&A
Google Analytics: Q&ABen MacNeill
 
Evaluate Content with Google Analytics (Oct 2009)
Evaluate Content with Google Analytics (Oct 2009)Evaluate Content with Google Analytics (Oct 2009)
Evaluate Content with Google Analytics (Oct 2009)Ben MacNeill
 
Advanced Google Analytics Techniques
Advanced Google Analytics Techniques Advanced Google Analytics Techniques
Advanced Google Analytics Techniques Ben MacNeill
 
Subversion Clients for the Mac - svnX
Subversion Clients  for the Mac - svnXSubversion Clients  for the Mac - svnX
Subversion Clients for the Mac - svnXBen MacNeill
 
Data-driven parenting - Trixie Tracker
Data-driven parenting - Trixie TrackerData-driven parenting - Trixie Tracker
Data-driven parenting - Trixie TrackerBen MacNeill
 
Presenting Visual Information(Notes)
Presenting Visual Information(Notes)Presenting Visual Information(Notes)
Presenting Visual Information(Notes)Ben MacNeill
 
Style Your Site Part 1
Style Your Site Part 1Style Your Site Part 1
Style Your Site Part 1Ben MacNeill
 
Best Practices for Structuring Your Web Content
Best Practices for Structuring Your  Web ContentBest Practices for Structuring Your  Web Content
Best Practices for Structuring Your Web ContentBen MacNeill
 
Πεπτικό Σύστημα
Πεπτικό ΣύστημαΠεπτικό Σύστημα
Πεπτικό ΣύστημαPetros Karapetros
 

Viewers also liked (11)

Google Analytics: Q&A
Google Analytics: Q&AGoogle Analytics: Q&A
Google Analytics: Q&A
 
Evaluate Content with Google Analytics (Oct 2009)
Evaluate Content with Google Analytics (Oct 2009)Evaluate Content with Google Analytics (Oct 2009)
Evaluate Content with Google Analytics (Oct 2009)
 
Advanced Google Analytics Techniques
Advanced Google Analytics Techniques Advanced Google Analytics Techniques
Advanced Google Analytics Techniques
 
Subversion Clients for the Mac - svnX
Subversion Clients  for the Mac - svnXSubversion Clients  for the Mac - svnX
Subversion Clients for the Mac - svnX
 
Ask an Expert 2.0
Ask an Expert 2.0Ask an Expert 2.0
Ask an Expert 2.0
 
Data-driven parenting - Trixie Tracker
Data-driven parenting - Trixie TrackerData-driven parenting - Trixie Tracker
Data-driven parenting - Trixie Tracker
 
Presenting Visual Information(Notes)
Presenting Visual Information(Notes)Presenting Visual Information(Notes)
Presenting Visual Information(Notes)
 
Style Your Site Part 1
Style Your Site Part 1Style Your Site Part 1
Style Your Site Part 1
 
Best Practices for Structuring Your Web Content
Best Practices for Structuring Your  Web ContentBest Practices for Structuring Your  Web Content
Best Practices for Structuring Your Web Content
 
Πεπτικό Σύστημα
Πεπτικό ΣύστημαΠεπτικό Σύστημα
Πεπτικό Σύστημα
 
Lean Six-Sigma 101
Lean Six-Sigma 101Lean Six-Sigma 101
Lean Six-Sigma 101
 

Similar to Responsive web design

Great Responsive-ability Web Design
Great Responsive-ability Web DesignGreat Responsive-ability Web Design
Great Responsive-ability Web DesignMike Wilcox
 
Advancio, Inc. Academy: Responsive Web Design
Advancio, Inc. Academy: Responsive Web DesignAdvancio, Inc. Academy: Responsive Web Design
Advancio, Inc. Academy: Responsive Web DesignAdvancio
 
An Introduction to Responsive Design
An Introduction to Responsive DesignAn Introduction to Responsive Design
An Introduction to Responsive DesignValtech UK
 
Responsive Web Design - Web & PHP Conference - 2013-09-18
Responsive Web Design - Web & PHP Conference - 2013-09-18Responsive Web Design - Web & PHP Conference - 2013-09-18
Responsive Web Design - Web & PHP Conference - 2013-09-18Frédéric Harper
 
Responsive Web Design - Drupal Camp CPH
Responsive Web Design - Drupal Camp CPHResponsive Web Design - Drupal Camp CPH
Responsive Web Design - Drupal Camp CPHPeytz Design
 
Responsive Web Design & APEX Theme 25 (OGh APEX World 2014)
Responsive Web Design & APEX Theme 25 (OGh APEX World 2014)Responsive Web Design & APEX Theme 25 (OGh APEX World 2014)
Responsive Web Design & APEX Theme 25 (OGh APEX World 2014)Christian Rokitta
 
Responsive Web Design & APEX Theme 25
Responsive Web Design & APEX Theme 25Responsive Web Design & APEX Theme 25
Responsive Web Design & APEX Theme 25Christian Rokitta
 
Let's dig into the Omega Theme!
Let's dig into the Omega Theme!Let's dig into the Omega Theme!
Let's dig into the Omega Theme!Mediacurrent
 
Responsive Design & Mobile First
Responsive Design & Mobile FirstResponsive Design & Mobile First
Responsive Design & Mobile FirstLuke Brooker
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web DesignJustin Avery
 
Intro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS featuresIntro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS featuresAndreas Bovens
 
Responsive UX - One size fits all @BigDesign conference #BigD12
Responsive UX - One size fits all   @BigDesign conference #BigD12Responsive UX - One size fits all   @BigDesign conference #BigD12
Responsive UX - One size fits all @BigDesign conference #BigD12touchtitans
 
Responsive Web Design - Devoxx UK - 2014-06-13
Responsive Web Design - Devoxx UK - 2014-06-13Responsive Web Design - Devoxx UK - 2014-06-13
Responsive Web Design - Devoxx UK - 2014-06-13Frédéric Harper
 
Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesVitaly Friedman
 
FITC - 2012-04-23 - Responsive Web Design
FITC - 2012-04-23 - Responsive Web DesignFITC - 2012-04-23 - Responsive Web Design
FITC - 2012-04-23 - Responsive Web DesignFrédéric Harper
 
Responsive Websites
Responsive WebsitesResponsive Websites
Responsive WebsitesJoe Seifi
 
Responsive Web Design - What You Need to Know to Get Started
Responsive Web Design - What You Need to Know to Get StartedResponsive Web Design - What You Need to Know to Get Started
Responsive Web Design - What You Need to Know to Get Startedjennybchicken
 
Adobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + FireworksAdobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + FireworksNathan Smith
 
Lect-4-Responsive-Web-06032024-082044am.pptx
Lect-4-Responsive-Web-06032024-082044am.pptxLect-4-Responsive-Web-06032024-082044am.pptx
Lect-4-Responsive-Web-06032024-082044am.pptxzainm7032
 
Responsive Design in iMIS Part 2
Responsive Design in iMIS Part 2Responsive Design in iMIS Part 2
Responsive Design in iMIS Part 2Andrea Robertson
 

Similar to Responsive web design (20)

Great Responsive-ability Web Design
Great Responsive-ability Web DesignGreat Responsive-ability Web Design
Great Responsive-ability Web Design
 
Advancio, Inc. Academy: Responsive Web Design
Advancio, Inc. Academy: Responsive Web DesignAdvancio, Inc. Academy: Responsive Web Design
Advancio, Inc. Academy: Responsive Web Design
 
An Introduction to Responsive Design
An Introduction to Responsive DesignAn Introduction to Responsive Design
An Introduction to Responsive Design
 
Responsive Web Design - Web & PHP Conference - 2013-09-18
Responsive Web Design - Web & PHP Conference - 2013-09-18Responsive Web Design - Web & PHP Conference - 2013-09-18
Responsive Web Design - Web & PHP Conference - 2013-09-18
 
Responsive Web Design - Drupal Camp CPH
Responsive Web Design - Drupal Camp CPHResponsive Web Design - Drupal Camp CPH
Responsive Web Design - Drupal Camp CPH
 
Responsive Web Design & APEX Theme 25 (OGh APEX World 2014)
Responsive Web Design & APEX Theme 25 (OGh APEX World 2014)Responsive Web Design & APEX Theme 25 (OGh APEX World 2014)
Responsive Web Design & APEX Theme 25 (OGh APEX World 2014)
 
Responsive Web Design & APEX Theme 25
Responsive Web Design & APEX Theme 25Responsive Web Design & APEX Theme 25
Responsive Web Design & APEX Theme 25
 
Let's dig into the Omega Theme!
Let's dig into the Omega Theme!Let's dig into the Omega Theme!
Let's dig into the Omega Theme!
 
Responsive Design & Mobile First
Responsive Design & Mobile FirstResponsive Design & Mobile First
Responsive Design & Mobile First
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
 
Intro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS featuresIntro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS features
 
Responsive UX - One size fits all @BigDesign conference #BigD12
Responsive UX - One size fits all   @BigDesign conference #BigD12Responsive UX - One size fits all   @BigDesign conference #BigD12
Responsive UX - One size fits all @BigDesign conference #BigD12
 
Responsive Web Design - Devoxx UK - 2014-06-13
Responsive Web Design - Devoxx UK - 2014-06-13Responsive Web Design - Devoxx UK - 2014-06-13
Responsive Web Design - Devoxx UK - 2014-06-13
 
Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and Techniques
 
FITC - 2012-04-23 - Responsive Web Design
FITC - 2012-04-23 - Responsive Web DesignFITC - 2012-04-23 - Responsive Web Design
FITC - 2012-04-23 - Responsive Web Design
 
Responsive Websites
Responsive WebsitesResponsive Websites
Responsive Websites
 
Responsive Web Design - What You Need to Know to Get Started
Responsive Web Design - What You Need to Know to Get StartedResponsive Web Design - What You Need to Know to Get Started
Responsive Web Design - What You Need to Know to Get Started
 
Adobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + FireworksAdobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + Fireworks
 
Lect-4-Responsive-Web-06032024-082044am.pptx
Lect-4-Responsive-Web-06032024-082044am.pptxLect-4-Responsive-Web-06032024-082044am.pptx
Lect-4-Responsive-Web-06032024-082044am.pptx
 
Responsive Design in iMIS Part 2
Responsive Design in iMIS Part 2Responsive Design in iMIS Part 2
Responsive Design in iMIS Part 2
 

Recently uploaded

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Responsive web design

  • 1. Responsive Web Design Ben MacNeill ben.macneill@extension.org Twitter: @chillnc Presentation at: slideshare.net/chillnc/ Demo files: extension.org/share/netc/rwd/
  • 2. This presentation pulls from this excellent book: Responsive Web Design by Ethan Marcotte
  • 3. What is Responsive Web Design?
  • 6. Why Responsive Design? • Designing for specific devices — too many • Siloed pages: /mobile/page.html  — trapped
  • 7. Three Components • A flexible grid-based layout • Flexible images and media • Media queries (CSS3)
  • 8. The Grid http://grids.heroku.com/
  • 9.
  • 10. 960px page, 60px column, 12 wide with 20px gutter
  • 11. 960px page 940px 620px 300px 600px 280px
  • 12. Traditional Fixed Grid #page  {   margin:  36px  auto;   width:  960px; }
  • 13. Flexible Grid #page  {   margin:  36px  auto;   width:  90%; } (90% is somewhat arbitrary)
  • 14. 960px page 940px 620px 300px 600px 280px How does 940px translate to a flexible width? It depends on its container.
  • 15. Pixels to Percentages target  ÷  context  =  result #title #page 940px 960px %
  • 16. 940px  ÷  960px  =  0.979166666666667 97.9166666666667% target  ÷  context  =  result
  • 17. #page  {   margin:  36px  auto;   width:  90%; } #title  {   width:  97.9166666666667%;   //  940px  ÷  960px }
  • 18. 960px page 940px 620px 300px 600px 280px 620px  ÷  960px  =  0.645833333333333 300px  ÷  960px  =  0.3125 600px  ÷  620px  =  0.967741935483871 280px  ÷  300px  =  0.933333333333333
  • 20. Fluid to a Fault (we'll come back to this problem)
  • 21. We also need Fluid Typography body  {font-­‐size:  100%} 24px  ÷  16px  =  1.5em h1  {font-­‐size:  1.5em} target  ÷  context  =  result
  • 22. Three Components • A flexible grid-based layout • Flexible images and media • Media queries (CSS3)
  • 24. Basic Markup .image  { float:  right; margin-­‐bottom:  0.5em; margin-­‐left:  01.6666666666667%; /*  10px  ÷  600px  */ width:  50%;  /*  300px  ÷  600px  */ } <p  class="image"> <img  src="turtle.jpg"  /> </p>
  • 25.
  • 26.
  • 28.
  • 30. Caveats • max-width doesn't work in IE6 • Image scaling hiccups in IE7 & FF2
  • 31. We don’t care about IE6.
  • 32. Is it okay to stop caring about IE7? • IE7 user base (2.3% - 3.5% May 2012) • Google stopped supporting in Aug 2011 • Facebook began phasing out support in Dec 2011 • Microsoft is discontinuing support in July 2013 • Flexible images work, just somewhat degraded
  • 33. Three Components • A flexible grid-based layout • Flexible images and media • Media queries (CSS3)
  • 34. In the Beginning... Media Types <link  rel="stylesheet"  href="main.css"  media="screen"  /> <link  rel="stylesheet"  href="paper.css"  media="print"  /> <link  rel="stylesheet"  href="tiny.css"  media="handheld"/> • Early phones had poor browsers • Media Types proved too broad
  • 35. Media Query @media  screen  and  (min-­‐width:  1024px)  { body  {font-­‐size:  100%;} } • Contains two components: media type and (query) • The query contains a feature and a value • Can be placed right in your stylesheet
  • 36. Short Detour: Reseting the Viewport • Modern mobile browsers pretend that web pages are desktop-browser size (~900px) • They render them at that size • Then shrink the resulting page to fit in the device window
  • 37.
  • 38. Override the Default  <meta  name="viewport"   content="initial-­‐scale=1.0,   width=device-­‐width"  /> • Makes width of the browser’s viewport equal to the width of the device’s screen
  • 39. Default Viewport Reset Viewport 980px 320px
  • 40. Fluid to a Fault (Remember? I said we'd come back to this problem.) Answer: Linearize
  • 41. Need to remove Flexible Widths #main  { float:left; margin:  10px  1.041666666666667%;// 10px ÷ 960px width:  64.5833333333333%; // 620px ÷ 960px } #other  { float:right; margin:  10px  1.041666666666667%;// 10px ÷ 960px width:  29.1666666666667%; // 280px ÷ 960px }
  • 42. Target Tablets and Smaller @media  screen  and  (max-­‐width:  768px)  { //  css  goes  here } • This rule tells the browser to render the enclosed CSS if the viewport is smaller than 768px *The iPad is 768px in portrait orientation
  • 43. #main  { float:left; margin:  10px  1.041666666666667%; width:  64.5833333333333%;  } #other  { float:right; margin:  10px  1.041666666666667%; width:  29.1666666666667%;  } @media  screen  and  (max-­‐width:  768px)  {   #main,  #other  {     margin:  10px;     width:  auto;   } }
  • 44. Layout Responds to Resizing 769px 768px
  • 45. More Linearization for Smaller Devices .image  { width:  50%; } @media  screen  and  (max-­‐width:  480px)  {   .image  {     width:  auto;   } }
  • 46. 481px 400px
  • 47. Going Larger Design for larger page @media  screen  and  (min-­‐width:  1200px)  {...} Or limit your page size #page  {max-­‐width:1024px}
  • 48. Media Query Support 3.5+ 3+ 9.5+ 9+ *can fill in some gaps with respond.js
  • 49. Three Components • A flexible grid-based layout • Flexible images and media • Media queries (CSS3)
  • 50. The Strategy So Far /*  desktop  styles  for  flexible  grid  and  media  */ #page  {...} /*  media  queries  targeting  different  breakpoints  */ @media  screen  and  (max-­‐width:  768px)  {...} @media  screen  and  (max-­‐width:  480px)  {...}
  • 51. Potential Problems • Some devices will not understand media queries • Some mobile devices will not have javascript However, a flexible layout provides a good fallback
  • 52. Mobile First • Have your design default to a simple, small-screen layout (very linear) • Progressively enhance the design using media queries as the viewport resolution increases • If a browser lacks media query support (and javascript isn't available as a fix), they get the attractive, single-column layout
  • 53. The Revised Strategy /*  default,  linear  layout  */ #page  { width:  auto; max-­‐width:  700px; } /*  media  queries  build  a  flexible  layout  and  enhance  at   different  breakpoints  */ @media  screen  and  (min-­‐width:  600px)  {...} @media  screen  and  (min-­‐width:  860px)  {...} @media  screen  and  (min-­‐width:  1024px)  {...}
  • 54. Final Result: Mobile First Responsive Design example: http://ethanmarcotte.com/
  • 55. Common Breakpoints 320 pixels For small screen devices, like phones, held in portrait mode. 480 pixels For small screen devices, like phones, held in landscape mode. Smaller tablets, like the Amazon Kindle (600×800) and Barnes & 600 pixels Noble Nook (600×1024), held in portrait mode. 768 pixels Ten-inch tablets like the iPad (768×1024) held in portrait mode. Tablets like the iPad (1024×768) held in landscape mode, as well as 1024 pixels certain laptop, netbook, and desktop displays. 1200 pixels For widescreen displays, primarily laptop and desktop browsers.
  • 56. Awesome RWD Examples • http://responsivewebdesign.com/robot/ • http://letsembark.com/ • http://cognition.happycog.com/ More Reading • Responsive Web Design – Ideas, Technology, and Examples http://www.onextrapixel.com/2012/05/17/responsive-web-design-ideas-technology-and-examples/ • Ethan Marcotte's original article http://www.alistapart.com/articles/responsive-web-design/ • Responsive design – harnessing the power of media queries http://googlewebmastercentral.blogspot.co.uk/2012/04/responsive-design-harnessing-power-of.html • Responsive Web Design (The book) http://www.abookapart.com/products/responsive-web-design