SlideShare une entreprise Scribd logo
1  sur  23
Responsive Web
Design & Development




                   John Fitzgerald
Overview

What is Responsive Web Design

Benefits of adoption

Challenges of adoption

Responsive methods (The Technical Part)

Helper Tools
What is RWD?


A method of building web views which
adapt to the display of the device on
which they are viewed
Benefits of Building
       Responsively
Allows the development of a consolidated front-
end codebase for use on all devices

Improves maintainability of codebase

Reduces frequency of app submissions and allows
apps to be updated transparently, without forcing
users to download from iTunes or Android
Marketplace

Reduces expense of maintaining separate teams
to maintain codebases for different devices
The Challenges of
          Becoming Responsive
       More thought must go into designs

       Designer and developer learning curve

       Responsive views take more time to build than
       fixed views*

       Responsive views require more testing than fixed
       views*

* but not more than 3 separate views.
Responsive Methods
Reset CSS

Percentage Widths

Responsive Font Sizing

Responsive Image Sizing

Viewport Control

CSS Media Queries
Reset CSS
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
    text-decoration:none;
    list-style:none;
}
Percentage Widths
The Most Important
   Equation in the
Responsive Web World
TARGET / CONTEXT = RESULT
Typical % Calculation
  445px / 898px = 0.495545657
Commenting % Widths
#header #btn-homepage{
    position:absolute;
    width:16.17977528%;   /*   144 / 890   */
    min-width: 100px;
    bottom:20px;
    right:0;
}
Hazards of Percentages
Margin:
Calculated based on width of parent of the
element to which they’re assigned.

Padding:
Calculated based on the width of the element to
which they’re assigned.
Responsive Font Sizing

em units rather than pixels
Default font size in browsers: 16 pixels
Responsive Images
Responsive Images	
max-width: 100%;

Constrains image width to a maximum of the size
of the containing element

Supported in all modern browsers

Images sized in this way are downloaded at native
size, even if displayed at far smaller scale.

Background images and sprites have limited
usefulness in responsive web design, due to
currently-supported browser feature-sets.
Viewport Control
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=yes"/>

  Property        Description
                  Width of the viewport in pixels (or device-width).
    width
                  If width isn’t set, it defaults to a desktop size (980px on mobile Safari).
                  Height of the viewport in pixels (or device-height).
   height
                  Generally you don’t need to worry about setting this property.
                  (0 to 10.0) Multiplier that sets the scale of the page after its initial display.
 initial-scale    Safe bet: if you need to set it, set it to 1.0.
                  Larger values = zoomed in, smaller values = zoomed out

 minimum-         (0 to 10.0) The minimum multiplier the user can “zoom out” to.
   scale          Defaults to 0.25 on mobile Safari.

 maximum-         (0 to 10.0) The minimum multiplier the user can “zoom in” to.
   scale          Defaults to 1.6 on mobile Safari.

              (yes/no) Whether to allow a user from scaling in/out (zooming in/out).
user-scalable
              Default to “yes” on mobile Safari.
CSS Media Queries
 Two ways to use media queries:
<link rel="stylesheet" href="screen.css"
media="screen and (min-width: 1024px)" /
>
@media screen and (min-width: 1024px) {}

 The logical “and” can be used to join multiple
 queries
@media screen and (min-width: 1024px)
and (max-width: 1228px) {}
Media Query Features
Media queries test for the existence or extent of
device features to conditionally load CSS or apply
styles.

“Rendering Surface” is the device’s entire screen.

“Display Area” is the browser window on the
device.
HAS min- AND
FEATURE                                           DEFINITION
                                                                                                  max- PREFIXES
    width        The width of the display area                                                         YES
    height       The height of the display area                                                        YES
 device-width    The width of the device’s rendering surface                                           YES
device-height    The Height of the device’s rendering surface                                          YES
  orientation    Accepts portrait or landscape value                                                   NO
                 Ratio of the display area’s width over its height. For example: on a desktop,
 aspect-ratio                                                                                          YES
                 you’d be able to query if the browser window is at a 16:9 aspect ratio.

device-aspect-   Ratio of the device’s rendering surface width over its height. For example: on
                                                                                                       YES
     ratio       a desktop, you’d be able to query if the screen is at a 16:9 aspect ratio.

                 The number of bits per color component of the device. For example, an 8-bit
    color        color device would successfully pass a query of (color: 8). Non-color devices         YES
                 should return a value of 0.
                 The number of entries in the color lookup table of the output device. For
 color-index                                                                                           YES
                 example, @media screen and (min-color-index: 256).

                 The number of bits per pixel on a monochrome device If the device is not a
monochrome                                                                                             YES
                 monochrome device, the output device value will be 0.

                 Tests the density of the pixels in the device, such as:
  resolution                                                                                           YES
                  screen and (resolution: 72dpi) or screen and (max-resolution: 300dpi).

                 For tv-based browsing, measures whether the scanning process is either
     scan                                                                                              NO
                 progressive or scan.

                 Tests whether the device is a grid-based display, like feature phones with one
     grid                                                                                              NO
                 fixed-width font. Can be expressed simply as (grid).
Device-specific Queries
/* Smartphones (portrait and landscape) */   /* iPads (portrait) */
@media only screen                           @media only screen
and (min-device-width : 320px)               and (min-device-width : 768px)
and (max-device-width : 480px) {             and (max-device-width : 1024px)
/* Styles */                                 and (orientation : portrait) {
}                                            /* Styles */
                                             }
/* Smartphones (landscape) */
@media only screen                           /* Desktops and laptops */
and (min-width : 321px) {                    @media only screen
/* Styles */                                 and (min-width : 1224px) {
}                                            /* Styles */
                                             }
/* Smartphones (portrait) */
@media only screen                           /* Large screens */
and (max-width : 320px) {                    @media only screen
/* Styles */                                 and (min-width : 1824px) {
}                                            /* Styles */
                                             }
/* iPads (portrait and landscape) */
@media only screen                           /* iPhone 4 */
and (min-device-width : 768px)               @media
and (max-device-width : 1024px) {            only screen and (-webkit-min-device-pixel-ratio :
/* Styles */                                 1.5),
}                                            only screen and (min-device-pixel-ratio : 1.5) {
                                             /* Styles */
/* iPads (landscape) ----------- */          }
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}
Helper Tools
Modernizr:
A JavaScript Library which allows web views
which take advantage of less-fully supported
features to display properly on older browsers.
modernizr.com

Skeleton:
A library of JavaScript and CSS files meant to
allow fast creation of responsive web views.
getskeleton.com
Final Thoughts
To achieve the best results, front-end devs and
designers should collaborate when creating
responsive mocks/templates.

Responsiveness is a mindset. When approaching
a new view, resist the urge to lock things down
and, instead, think fluidly.

Responsive Web Design is evolving as standards
and browser adoption of those standards change.

There is no substitute for looking at a view on the
devices on which users will be viewing it.
?’s

Contenu connexe

Similaire à Responsive Web Design & Development

Designing for mobile
Designing for mobileDesigning for mobile
Designing for mobileDee Sadler
 
Presentación WPmallorca PalmaActiva responsive design
Presentación WPmallorca PalmaActiva responsive designPresentación WPmallorca PalmaActiva responsive design
Presentación WPmallorca PalmaActiva responsive designWPMallorca
 
Webinar: Top 5 Mistakes Your Don't Want to Make When Moving to the Cloud
Webinar: Top 5 Mistakes Your Don't Want to Make When Moving to the CloudWebinar: Top 5 Mistakes Your Don't Want to Make When Moving to the Cloud
Webinar: Top 5 Mistakes Your Don't Want to Make When Moving to the CloudInternap
 
Firefox3.5 And Next
Firefox3.5 And NextFirefox3.5 And Next
Firefox3.5 And NextChanny Yun
 
Dynamics NAV, Windows Azure & Windows Phone 7, Eric Wauters
Dynamics NAV, Windows Azure & Windows Phone 7, Eric WautersDynamics NAV, Windows Azure & Windows Phone 7, Eric Wauters
Dynamics NAV, Windows Azure & Windows Phone 7, Eric Wautersdynamicscom
 
Divyanshu open stack presentation -osi-ppt
Divyanshu open stack presentation -osi-pptDivyanshu open stack presentation -osi-ppt
Divyanshu open stack presentation -osi-pptOpenSourceIndia
 
Divyanshu open stack presentation -osi-ppt
Divyanshu open stack presentation -osi-pptDivyanshu open stack presentation -osi-ppt
Divyanshu open stack presentation -osi-pptsuniltomar04
 
Mobile Cloud Architectures
Mobile Cloud ArchitecturesMobile Cloud Architectures
Mobile Cloud ArchitecturesDavid Coallier
 
Designing for Inclusion with Media Queries
Designing for Inclusion with Media QueriesDesigning for Inclusion with Media Queries
Designing for Inclusion with Media QueriesEric Bailey
 
A short introduction to the cloud
A short introduction to the cloudA short introduction to the cloud
A short introduction to the cloudLaurent Eschenauer
 
Yacht Charter Reservation August 2009
Yacht Charter Reservation August 2009Yacht Charter Reservation August 2009
Yacht Charter Reservation August 2009Latitude 26
 
Vineet Choudhry Portfolio
Vineet Choudhry PortfolioVineet Choudhry Portfolio
Vineet Choudhry PortfolioRakesh Ranjan
 
Analysis process designer (apd) part 2
Analysis process designer (apd) part   2Analysis process designer (apd) part   2
Analysis process designer (apd) part 2dejavee
 
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
 
Operating systems 1
Operating systems 1Operating systems 1
Operating systems 1JoshuaIgo
 
Designing Android apps for multiple screens
Designing Android apps for multiple screensDesigning Android apps for multiple screens
Designing Android apps for multiple screensAbhijeet Dutta
 

Similaire à Responsive Web Design & Development (20)

Designing for mobile
Designing for mobileDesigning for mobile
Designing for mobile
 
Presentación WPmallorca PalmaActiva responsive design
Presentación WPmallorca PalmaActiva responsive designPresentación WPmallorca PalmaActiva responsive design
Presentación WPmallorca PalmaActiva responsive design
 
Webinar: Top 5 Mistakes Your Don't Want to Make When Moving to the Cloud
Webinar: Top 5 Mistakes Your Don't Want to Make When Moving to the CloudWebinar: Top 5 Mistakes Your Don't Want to Make When Moving to the Cloud
Webinar: Top 5 Mistakes Your Don't Want to Make When Moving to the Cloud
 
Firefox3.5 And Next
Firefox3.5 And NextFirefox3.5 And Next
Firefox3.5 And Next
 
Dynamics NAV, Windows Azure & Windows Phone 7, Eric Wauters
Dynamics NAV, Windows Azure & Windows Phone 7, Eric WautersDynamics NAV, Windows Azure & Windows Phone 7, Eric Wauters
Dynamics NAV, Windows Azure & Windows Phone 7, Eric Wauters
 
Divyanshu open stack presentation -osi-ppt
Divyanshu open stack presentation -osi-pptDivyanshu open stack presentation -osi-ppt
Divyanshu open stack presentation -osi-ppt
 
Divyanshu open stack presentation -osi-ppt
Divyanshu open stack presentation -osi-pptDivyanshu open stack presentation -osi-ppt
Divyanshu open stack presentation -osi-ppt
 
Ubiquisys at Femtocells Americas 11
Ubiquisys at Femtocells Americas 11Ubiquisys at Femtocells Americas 11
Ubiquisys at Femtocells Americas 11
 
Mobile Cloud Architectures
Mobile Cloud ArchitecturesMobile Cloud Architectures
Mobile Cloud Architectures
 
Designing for Inclusion with Media Queries
Designing for Inclusion with Media QueriesDesigning for Inclusion with Media Queries
Designing for Inclusion with Media Queries
 
A short introduction to the cloud
A short introduction to the cloudA short introduction to the cloud
A short introduction to the cloud
 
Evaluation Part Four
Evaluation Part FourEvaluation Part Four
Evaluation Part Four
 
Yacht Charter Reservation August 2009
Yacht Charter Reservation August 2009Yacht Charter Reservation August 2009
Yacht Charter Reservation August 2009
 
Vineet Choudhry Portfolio
Vineet Choudhry PortfolioVineet Choudhry Portfolio
Vineet Choudhry Portfolio
 
Analysis process designer (apd) part 2
Analysis process designer (apd) part   2Analysis process designer (apd) part   2
Analysis process designer (apd) part 2
 
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
 
About Anewtech Systems
About Anewtech SystemsAbout Anewtech Systems
About Anewtech Systems
 
Operating systems 1
Operating systems 1Operating systems 1
Operating systems 1
 
Designing Android apps for multiple screens
Designing Android apps for multiple screensDesigning Android apps for multiple screens
Designing Android apps for multiple screens
 

Dernier

What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
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
 
"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
 
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
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 

Dernier (20)

What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
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
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
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
 
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
 
"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
 
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
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 

Responsive Web Design & Development

  • 1. Responsive Web Design & Development John Fitzgerald
  • 2. Overview What is Responsive Web Design Benefits of adoption Challenges of adoption Responsive methods (The Technical Part) Helper Tools
  • 3. What is RWD? A method of building web views which adapt to the display of the device on which they are viewed
  • 4. Benefits of Building Responsively Allows the development of a consolidated front- end codebase for use on all devices Improves maintainability of codebase Reduces frequency of app submissions and allows apps to be updated transparently, without forcing users to download from iTunes or Android Marketplace Reduces expense of maintaining separate teams to maintain codebases for different devices
  • 5. The Challenges of Becoming Responsive More thought must go into designs Designer and developer learning curve Responsive views take more time to build than fixed views* Responsive views require more testing than fixed views* * but not more than 3 separate views.
  • 6. Responsive Methods Reset CSS Percentage Widths Responsive Font Sizing Responsive Image Sizing Viewport Control CSS Media Queries
  • 7. Reset CSS html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; text-decoration:none; list-style:none; }
  • 9. The Most Important Equation in the Responsive Web World TARGET / CONTEXT = RESULT
  • 10. Typical % Calculation 445px / 898px = 0.495545657
  • 11. Commenting % Widths #header #btn-homepage{ position:absolute; width:16.17977528%; /* 144 / 890 */ min-width: 100px; bottom:20px; right:0; }
  • 12. Hazards of Percentages Margin: Calculated based on width of parent of the element to which they’re assigned. Padding: Calculated based on the width of the element to which they’re assigned.
  • 13. Responsive Font Sizing em units rather than pixels Default font size in browsers: 16 pixels
  • 15. Responsive Images max-width: 100%; Constrains image width to a maximum of the size of the containing element Supported in all modern browsers Images sized in this way are downloaded at native size, even if displayed at far smaller scale. Background images and sprites have limited usefulness in responsive web design, due to currently-supported browser feature-sets.
  • 16. Viewport Control <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=yes"/> Property Description Width of the viewport in pixels (or device-width). width If width isn’t set, it defaults to a desktop size (980px on mobile Safari). Height of the viewport in pixels (or device-height). height Generally you don’t need to worry about setting this property. (0 to 10.0) Multiplier that sets the scale of the page after its initial display. initial-scale Safe bet: if you need to set it, set it to 1.0. Larger values = zoomed in, smaller values = zoomed out minimum- (0 to 10.0) The minimum multiplier the user can “zoom out” to. scale Defaults to 0.25 on mobile Safari. maximum- (0 to 10.0) The minimum multiplier the user can “zoom in” to. scale Defaults to 1.6 on mobile Safari. (yes/no) Whether to allow a user from scaling in/out (zooming in/out). user-scalable Default to “yes” on mobile Safari.
  • 17. CSS Media Queries Two ways to use media queries: <link rel="stylesheet" href="screen.css" media="screen and (min-width: 1024px)" / > @media screen and (min-width: 1024px) {} The logical “and” can be used to join multiple queries @media screen and (min-width: 1024px) and (max-width: 1228px) {}
  • 18. Media Query Features Media queries test for the existence or extent of device features to conditionally load CSS or apply styles. “Rendering Surface” is the device’s entire screen. “Display Area” is the browser window on the device.
  • 19. HAS min- AND FEATURE DEFINITION max- PREFIXES width The width of the display area YES height The height of the display area YES device-width The width of the device’s rendering surface YES device-height The Height of the device’s rendering surface YES orientation Accepts portrait or landscape value NO Ratio of the display area’s width over its height. For example: on a desktop, aspect-ratio YES you’d be able to query if the browser window is at a 16:9 aspect ratio. device-aspect- Ratio of the device’s rendering surface width over its height. For example: on YES ratio a desktop, you’d be able to query if the screen is at a 16:9 aspect ratio. The number of bits per color component of the device. For example, an 8-bit color color device would successfully pass a query of (color: 8). Non-color devices YES should return a value of 0. The number of entries in the color lookup table of the output device. For color-index YES example, @media screen and (min-color-index: 256). The number of bits per pixel on a monochrome device If the device is not a monochrome YES monochrome device, the output device value will be 0. Tests the density of the pixels in the device, such as: resolution YES screen and (resolution: 72dpi) or screen and (max-resolution: 300dpi). For tv-based browsing, measures whether the scanning process is either scan NO progressive or scan. Tests whether the device is a grid-based display, like feature phones with one grid NO fixed-width font. Can be expressed simply as (grid).
  • 20. Device-specific Queries /* Smartphones (portrait and landscape) */ /* iPads (portrait) */ @media only screen @media only screen and (min-device-width : 320px) and (min-device-width : 768px) and (max-device-width : 480px) { and (max-device-width : 1024px) /* Styles */ and (orientation : portrait) { } /* Styles */ } /* Smartphones (landscape) */ @media only screen /* Desktops and laptops */ and (min-width : 321px) { @media only screen /* Styles */ and (min-width : 1224px) { } /* Styles */ } /* Smartphones (portrait) */ @media only screen /* Large screens */ and (max-width : 320px) { @media only screen /* Styles */ and (min-width : 1824px) { } /* Styles */ } /* iPads (portrait and landscape) */ @media only screen /* iPhone 4 */ and (min-device-width : 768px) @media and (max-device-width : 1024px) { only screen and (-webkit-min-device-pixel-ratio : /* Styles */ 1.5), } only screen and (min-device-pixel-ratio : 1.5) { /* Styles */ /* iPads (landscape) ----------- */ } @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) { /* Styles */ }
  • 21. Helper Tools Modernizr: A JavaScript Library which allows web views which take advantage of less-fully supported features to display properly on older browsers. modernizr.com Skeleton: A library of JavaScript and CSS files meant to allow fast creation of responsive web views. getskeleton.com
  • 22. Final Thoughts To achieve the best results, front-end devs and designers should collaborate when creating responsive mocks/templates. Responsiveness is a mindset. When approaching a new view, resist the urge to lock things down and, instead, think fluidly. Responsive Web Design is evolving as standards and browser adoption of those standards change. There is no substitute for looking at a view on the devices on which users will be viewing it.
  • 23. ?’s

Notes de l'éditeur

  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