Slide 1

Slide 1 text

Mobile First Responsive Design Jason Grigsby • @grigs • cloudfour.com

Slide 2

Slide 2 text

The web has always been a balancing act… http://www.flickr.com/photos/classblog/5136926303

Slide 3

Slide 3 text

with many competing priorities. http://www.flickr.com/photos/tudor/4324056624/

Slide 4

Slide 4 text

Finding that balance is more difficult… http://www.flickr.com/photos/superfantastic/50088733/

Slide 5

Slide 5 text

http://www.flickr.com/photos/lyza/7382235106 as device diversity increases.

Slide 6

Slide 6 text

http://www.flickr.com/photos/darrentunnicliff/4232232092/ Responsive web design offers us for a sensible way to deal with device diversity.

Slide 7

Slide 7 text

And yet the one question I frequently ask myself is… http://www.flickr.com/photos/omcoc/6751047205

Slide 8

Slide 8 text

Can a one size fits all solution… http://www.flickr.com/photos/sldghmmr/6041481069

Slide 9

Slide 9 text

compete with a tailored experience? http://www.flickr.com/photos/helloturkeytoe/4932748746/

Slide 10

Slide 10 text

Important question from many perspectives:

Slide 11

Slide 11 text

http://www.flickr.com/photos/andercismo/2349098787 Search engine optimization

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

http://www.flickr.com/photos/brunauto/5062644167/

Slide 15

Slide 15 text

http://www.flickr.com/photos/brunauto/5062644167/ Mobile Context

Slide 16

Slide 16 text

80% during misc downtime 76% while waiting in lines 86% while watching TV 69% for point of sale research http://www.flickr.com/photos/carbonnyc/5140154965

Slide 17

Slide 17 text

TMI

Slide 18

Slide 18 text

39% use phone on toilet

Slide 19

Slide 19 text

Advertising http://www.flickr.com/photos/powerbooktrance/267059283

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

PERFORMANCE

Slide 23

Slide 23 text

http://www.akamai.com/dl/whitepapers/ecommerce_website_perf_wp.pdf People demand fast web sites.

Slide 24

Slide 24 text

Log In Subscribe Basket Contact Us i am looking for... 67% of consumers cite slow websites as the main cause of basket abandonment Daily Pulse Newsletter Get our free Daily Pulse Newsletter to keep informed about the latest news and insights in Digital Marketing. Register for our free Daily Pulse ADVERTISE HERE » by David Moth 06 December 2012 11:40 8 comments Print Tweet Tweet 236 3 Everyone hates slow loading websites, and a new survey highlights just how damaging a slow site can be to the user experience. The study by Brand Perfect found that two thirds of UK consumers (67%) cite slow loading times as the main reason they would abandon an online purchase. It’s a topic we’ve looked at in more detail in our post 'Site speed: case studies, tips and tools for improving your conversion rate', with stats showing that slow loading websites are losing businesses up to £1.73bn a year. Privacy and cookie policy Home / Blog Subscribe Reports Training Events Jobs Blog More Browse by topic Like 14 Share Share 20 Slow sites mean real dollars are lost.

Slide 25

Slide 25 text

Top ecommerce sites are 22% slower than last year http://www.webperformancetoday.com/2013/03/27/top-ecommerce-sites-are-slower-than-they-were-last-year/

Slide 26

Slide 26 text

http://www.gomez.com/wp-content/downloads/19986_WhatMobileUsersWant_Wp.pdf Mobile users don’t care that their network is slow.

Slide 27

Slide 27 text

Luke’s fantastic gesture reference: http://www.lukew.com/ff/entry.asp?1071

Slide 28

Slide 28 text

Luke’s fantastic gesture reference: http://www.lukew.com/ff/entry.asp?1071 Many ways to navigate desktop web sites on mobile.

Slide 29

Slide 29 text

http://www.flickr.com/photos/stephenjohnbryde/384095768/ There are no gestures that can make a web site faster.

Slide 30

Slide 30 text

http://www.flickr.com/photos/nathaninsandiego/4829858186/

Slide 31

Slide 31 text

http://www.flickr.com/photos/wesbrowning/5316400258/

Slide 32

Slide 32 text

http://www.flickr.com/photos/69797234@N06/7203485148/ BBG: Before Boston Globe

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

34.7K 8.1K 26.6K 76.6% 39.0K 8.4K 30.6K 78.4% 30.5K 6.7K 23.8K 78.0% Original Resized K Saved % Saved 43.4K 8.2K 35.2K 81.1% 26.0K 6.6K 19.4K 74.6% 34.7K 7.8K 26.9K 77.5% Original Resized K Saved % Saved

Slide 39

Slide 39 text

34.7K 8.1K 26.6K 76.6% 39.0K 8.4K 30.6K 78.4% 30.5K 6.7K 23.8K 78.0% Original Resized K Saved % Saved 43.4K 8.2K 35.2K 81.1% 26.0K 6.6K 19.4K 74.6% 34.7K 7.8K 26.9K 77.5% Original Resized K Saved % Saved

Slide 40

Slide 40 text

34.7K 8.1K 26.6K 76.6% 39.0K 8.4K 30.6K 78.4% 30.5K 6.7K 23.8K 78.0% Original Resized K Saved % Saved 43.4K 8.2K 35.2K 81.1% 26.0K 6.6K 19.4K 74.6% 34.7K 7.8K 26.9K 77.5% Original Resized K Saved % Saved Original Resized K Saved % Saved Total 208.3K 45.8K 162.5K 78.0%

Slide 41

Slide 41 text

The resounding answer from the community: Mobile First Responsive Web Design

Slide 42

Slide 42 text

“Awesome. We’ll devote a chapter to Mobile First Responsive Web Design in our book.”

Slide 43

Slide 43 text

“Awesome. We’ll devote a chapter to Mobile First Responsive Web Design in our book.” Famous last words.

Slide 44

Slide 44 text

9% 4% 21% 38% 4% 25% Mobile is Larger Same Size Less than 10% Savings 11 to 50% Savings 51% to 100% Savings Greater than 100% Savings Where are the Mobile First RWDs? 106 sites from mediaqueri.es tested http://blog.cloudfour.com/where-are-the-mobile-first-responsive-web-designs/

Slide 45

Slide 45 text

http://www.guypo.com/uncategorized/real-world-rwd-performance-take-2/ Guy Podjarny repeated the experiment 2013: 476 sites from mediaqueri.es tested

Slide 46

Slide 46 text

http://www.thefoxisblack.com/2012/10/02/the-design-thinking-behind-the-new-disney-com/

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

http://www.flickr.com/photos/beautyredefined/2643858323/

Slide 52

Slide 52 text

http://www.flickr.com/photos/puuikibeach/3654517679

Slide 53

Slide 53 text

Most responsive web designs are…

Slide 54

Slide 54 text

http://www.flickr.com/photos/myklroventine/3400040943/ Time to pen another fool’s gold post?

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

Being Responsive from a layout perspective should not preclude us from being responsive from a performance and interaction perspective. —Scott Jehl “ https://twitter.com/scottjehl/status/243025352069349377

Slide 58

Slide 58 text

5key techniques for responsible responsive design

Slide 59

Slide 59 text

http://www.flickr.com/photos/auyongcheemeng/95769332/ #1 Build Mobile First Responsive Designs

Slide 60

Slide 60 text

http://www.flickr.com/photos/localcelebrity/4831362933/ Different than Mobile First Design Theory

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

Mobile First Design Principles Mobile First Responsive Design Forwarded by Luke Wroblewski Technical Approach for Responsive Design

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

*

Slide 65

Slide 65 text

*FIRST Content First Structure First Performance First API First Command Line First

Slide 66

Slide 66 text

http://www.flickr.com/photos/leah8691/2184863624/

Slide 67

Slide 67 text

COFFEE FIRST! http://www.flickr.com/photos/leah8691/2184863624/

Slide 68

Slide 68 text

http://www.flickr.com/photos/gumption/3639682201/

Slide 69

Slide 69 text

But we’ve already got a desktop design and we can’t start over.

Slide 70

Slide 70 text

How do I make this responsive?

Slide 71

Slide 71 text

Many say responsive design won’t work for apps https://twitter.com/freediverx/status/354698695041744896

Slide 72

Slide 72 text

Responsive design for apps is inevitable. http://blog.cloudfour.com/responsive-design-for-apps-part-1/

Slide 73

Slide 73 text

Lines between device classes are blurring Model Type Size Size Display Resolution Resolution Viewport Viewport W H W H W H Samsung Galaxy Note 2 Phone 3.17” 5.95” 5.5” 720 1280 360 640 Motorola RAZR HD Phone 2.67” 5.19” 4.7” 720 1280 360 519 Motorola Atrix HD Phone 2.75” 5.26” 4.5” 720 1280 540 812 HTC Droid DNA Phone 2.78” 5.5” 5” 1080 1920 360 640 Nexus 7 Tablet 4.72” 7.81” 7” 800 1280 600 793 Kindle Fire Tablet 4.72” 7.44” 7” 600 1024 600 819 Kindle Fire HD Tablet 5.4” 7.6” 7” 800 1280 533 731

Slide 74

Slide 74 text

640 px 600 px 519 px 640 px 622 px 533 px 812 px Which are phones and which are tablets?

Slide 75

Slide 75 text

iPad, iPad Mini, iPad Air x 480 320 x 568 320 x 667 375 x 736 414 x 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 76

Slide 76 text

iPad, iPad Mini, iPad Air 480 320 568 320 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 77

Slide 77 text

iPad, iPad Mini, iPad Air 480 320 568 320 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 78

Slide 78 text

iPad, iPad Mini, iPad Air 480 320 568 320 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 79

Slide 79 text

iPad, iPad Mini, iPad Air 480 320 568 320 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 80

Slide 80 text

iPad, iPad Mini, iPad Air 480 320 568 320 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 81

Slide 81 text

iPad, iPad Mini, iPad Air 480 320 568 320 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 82

Slide 82 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 83

Slide 83 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 84

Slide 84 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 85

Slide 85 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 86

Slide 86 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 87

Slide 87 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 88

Slide 88 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 89

Slide 89 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 90

Slide 90 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 91

Slide 91 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 92

Slide 92 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 93

Slide 93 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 94

Slide 94 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 95

Slide 95 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 96

Slide 96 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum.

Slide 97

Slide 97 text

iPad, iPad Mini, iPad Air 480 320 568 667 375 736 414 768 1024 iPhone - iPhone 4s iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus Even iOS is now a continuum. The Magic 32 pixels

Slide 98

Slide 98 text

https://twitter.com/_munter_/status/511770590123143168

Slide 99

Slide 99 text

http://www.flickr.com/photos/geatchy/8489505999

Slide 100

Slide 100 text

How do I make this responsive?

Slide 101

Slide 101 text

How do I make this responsive?

Slide 102

Slide 102 text

How do I make this responsive?

Slide 103

Slide 103 text

http://www.flickr.com/photos/ancphotos_/6728574731

Slide 104

Slide 104 text

Ok, let’s start from a clean slate http://www.flickr.com/photos/salendron/5569020488/

Slide 105

Slide 105 text

No content

Slide 106

Slide 106 text

What would the mobile version look like?

Slide 107

Slide 107 text

What would the mobile version look like?

Slide 108

Slide 108 text

What would the mobile version look like?

Slide 109

Slide 109 text

How does that map to desktop design?

Slide 110

Slide 110 text

How does that map to desktop design?

Slide 111

Slide 111 text

How does that map to desktop design?

Slide 112

Slide 112 text

How does that map to desktop design?

Slide 113

Slide 113 text

How does that map to desktop design?

Slide 114

Slide 114 text

How does that map to desktop design?

Slide 115

Slide 115 text

How does that map to desktop design?

Slide 116

Slide 116 text

How does that map to desktop design?

Slide 117

Slide 117 text

How does that map to desktop design?

Slide 118

Slide 118 text

How does that map to desktop design?

Slide 119

Slide 119 text

How does that map to desktop design?

Slide 120

Slide 120 text

How does that map to desktop design?

Slide 121

Slide 121 text

How does that map to desktop design?

Slide 122

Slide 122 text

How does that map to desktop design?

Slide 123

Slide 123 text

Can this desktop version be better using what we’ve learned from the mobile version?

Slide 124

Slide 124 text

No content

Slide 125

Slide 125 text

This is why Mobile First thinking is so powerful even on existing projects.

Slide 126

Slide 126 text

Frequent concern for this project: How something will scale to desktop.

Slide 127

Slide 127 text

Frequent concern for this project: How something will scale to desktop. Actual times this has been a problem when mobile has been solid already: 0

Slide 128

Slide 128 text

No content

Slide 129

Slide 129 text

Small screen assets Large screen assets Progressive enhancement based on screen size Mobile First Responsive Web Design is a technical approach for responsive designs.

Slide 130

Slide 130 text

Mobile First Responsive Design Starts Simple: Reorder media queries so cascade goes from small to large screens

Slide 131

Slide 131 text

No content

Slide 132

Slide 132 text

/* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] /* Desktop layout styles */ [Desktop rules here] /* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] } Typical Desktop First Responsive CSS Likely the original CSS. Added for mobile.

Slide 133

Slide 133 text

/* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] /* Desktop layout styles */ [Desktop rules here] /* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] }

Slide 134

Slide 134 text

/* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] /* Desktop layout styles */ [Desktop rules here] /* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] }

Slide 135

Slide 135 text

/* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] /* Desktop layout styles */ [Desktop rules here] /* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] } Reorder CSS to Make it Mobile First

Slide 136

Slide 136 text

/* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] } /* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] /* Desktop layout styles */ [Desktop rules here] Reorder CSS to Make it Mobile First

Slide 137

Slide 137 text

/* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] } /* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] /* Desktop layout styles */ [Desktop rules here]

Slide 138

Slide 138 text

/* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] } /* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] /* Desktop layout styles */ [Desktop rules here]

Slide 139

Slide 139 text

/* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] } /* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] /* Desktop layout styles */ Add wide screen media query [Desktop rules here]

Slide 140

Slide 140 text

/* Desktop layout styles */ /* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] } /* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] Add wide screen media query [Desktop rules here]

Slide 141

Slide 141 text

/* Desktop layout styles */ /* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] } /* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] Add wide screen media query [Desktop rules here] @media screen and (min-width: 481px) {

Slide 142

Slide 142 text

/* Desktop layout styles */ /* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] } /* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] Add wide screen media query [Desktop rules here] @media screen and (min-width: 481px) {

Slide 143

Slide 143 text

/* Desktop layout styles */ /* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] } /* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] Add wide screen media query [Desktop rules here] @media screen and (min-width: 481px) { } The cascade is working for us: small to large.

Slide 144

Slide 144 text

/* Desktop layout styles */ /* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] } /* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] [Desktop rules here] @media screen and (min-width: 481px) { }

Slide 145

Slide 145 text

/* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] /* Desktop layout styles */ /* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] } [Desktop rules here] @media screen and (min-width: 481px) { }

Slide 146

Slide 146 text

/* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] /* Desktop layout styles */ /* Mobile (small screen) styles */ @media screen and (max-width: 480px) { [Mobile layout rules here] } [Desktop rules here] @media screen and (min-width: 481px) { } /* Baseline styles (e.g., reset, typography, colors) */ [Baseline rules here] Important to keep basic styles outside of media queries.

Slide 147

Slide 147 text

No content

Slide 148

Slide 148 text

The absence of support for media queries is in fact the first media query. —Bryan Rieger, Yiibu “

Slide 149

Slide 149 text

No content

Slide 150

Slide 150 text

No content

Slide 151

Slide 151 text

IE8 and below don’t support media queries.

Slide 152

Slide 152 text

No content

Slide 153

Slide 153 text

No content

Slide 154

Slide 154 text

Fallback for browsers w/o media queries

Slide 155

Slide 155 text

Fallback for browsers w/o media queries

Slide 156

Slide 156 text

Mobile First RWD = Fallback for browsers w/o media queries Mobile Fallback (More accurately, a baseline fallback)

Slide 157

Slide 157 text

No content

Slide 158

Slide 158 text

No content

Slide 159

Slide 159 text

IE conditional comments

Slide 160

Slide 160 text

IE conditional comments or use Respond.js (a media query polyfill for IE)

Slide 161

Slide 161 text

http://www.flickr.com/photos/lintmachine/2306383943/ #2 Keep CSS images in their place

Slide 162

Slide 162 text

No content

Slide 163

Slide 163 text

No content

Slide 164

Slide 164 text

No content

Slide 165

Slide 165 text

No content

Slide 166

Slide 166 text

No content

Slide 167

Slide 167 text

No content

Slide 168

Slide 168 text

@media screen and (max-width: 550px) { #content .homepage_background { display: none; } }

Slide 169

Slide 169 text

@media screen and (max-width: 550px) { #content .homepage_background { display: none; } } Images with display:none are still downloaded

Slide 170

Slide 170 text

@media screen and (max-width: 550px) { #content .homepage_background { display: none; } } Images with display:none are still downloaded downloaded and never displayed! 185K

Slide 171

Slide 171 text

http://timkadlec.com/2012/04/media-query-asset-downloading-results/

Slide 172

Slide 172 text

http://timkadlec.com/2012/04/media-query-asset-downloading-results/

Slide 173

Slide 173 text

@media all and (min-width: 601px) { #test5 { background-image:url('images/test5-desktop.png'); width:200px; height:75px; } } @media all and (max-width: 600px) { #test5 { background-image:url('images/test5-mobile.png'); width:200px; height:75px; } } #1: Images scoped within media queries http://timkadlec.com/2012/04/media-query-asset-downloading-results/ Only one rule can apply at any time.

Slide 174

Slide 174 text

http://timkadlec.com/2012/04/media-query-asset-downloading-results/
#test3 div { background-image:url('images/test3.png'); width:200px; height:75px; } @media all and (max-width: 600px) { #test3 { display:none; } } #2: display:none on parent element

Slide 175

Slide 175 text

http://timkadlec.com/2012/04/media-query-asset-downloading-results/
#test3 div { background-image:url('images/test3.png'); width:200px; height:75px; } @media all and (max-width: 600px) { #test3 { display:none; } } #2: display:none on parent element Why have extra markup in the DOM?

Slide 176

Slide 176 text

http://timkadlec.com/2012/04/media-query-asset-downloading-results/
#test4 { background-image:url('images/test4-desktop.png'); width:200px; height:75px; } @media all and (max-width: 600px) { #test4 { background-image:url('images/test4-mobile.png'); } } #3: Image override with a media query

Slide 177

Slide 177 text

http://timkadlec.com/2012/04/media-query-asset-downloading-results/
#test4 { background-image:url('images/test4-desktop.png'); width:200px; height:75px; } @media all and (max-width: 600px) { #test4 { background-image:url('images/test4-mobile.png'); } } #3: Image override with a media query

Slide 178

Slide 178 text

http://dev.w3.org/csswg/css-images-3/#image-set-notation http://blog.cloudfour.com/the-forgotten-responsive-images-spec-image-set/ background-image: image-set( "foo.png" 1x, "foo-2x.png" 2x, "foo-print.png" 600dpi ); The forgotten responsive image solution: image-set()

Slide 179

Slide 179 text

http://dev.w3.org/csswg/css-images-3/#image-set-notation http://blog.cloudfour.com/the-forgotten-responsive-images-spec-image-set/ background-image: image-set( "foo.png" 1x, "foo-2x.png" 2x, "foo-print.png" 600dpi ); The forgotten responsive image solution: image-set() Important for resolution switching use cases

Slide 180

Slide 180 text

VOTE image-set()

Slide 181

Slide 181 text

http://www.flickr.com/photos/lyza/7382255242/ #3 Conditionally load JS based on screen size and capabilities

Slide 182

Slide 182 text

No content

Slide 183

Slide 183 text

No content

Slide 184

Slide 184 text

No content

Slide 185

Slide 185 text

No content

Slide 186

Slide 186 text

No content

Slide 187

Slide 187 text

No content

Slide 188

Slide 188 text

Slide 189

Slide 189 text

[Maps JavaScript here]

Slide 190

Slide 190 text

[Maps JavaScript here] #map-holder { display: none; }

Slide 191

Slide 191 text

[Maps JavaScript here]

Slide 192

Slide 192 text

[Maps JavaScript here]

Slide 193

Slide 193 text

@media all and (min-width: 768px) { #map-holder, #map-logo { display: block; } } [Maps JavaScript here]

Slide 194

Slide 194 text

@media all and (min-width: 768px) { #map-holder, #map-logo { display: block; } } [Maps JavaScript here]

Slide 195

Slide 195 text

@media all and (min-width: 768px) { #map-holder, #map-logo { display: block; } } [Maps JavaScript here] Hiding content with display:none does not prevent it from downloading.

Slide 196

Slide 196 text

No content

Slide 197

Slide 197 text

if (matchMedia('only screen and (max-width: 480px)').matches) { // small-screen related dom scripting } Use matchMedia() JS to test media query matchMedia() polyfill for older browsers: https://github.com/paulirish/matchMedia.js

Slide 198

Slide 198 text

No content

Slide 199

Slide 199 text

Related External Links

AJAX Include Pattern https://github.com/filamentgroup/Ajax-Include-Pattern/

Slide 200

Slide 200 text

No content

Slide 201

Slide 201 text

Behavioral Breakpoints

Slide 202

Slide 202 text

Behavioral Breakpoints

Slide 203

Slide 203 text

Behavioral Breakpoints

Slide 204

Slide 204 text

Behavioral Breakpoints
Menu

Slide 205

Slide 205 text

Behavioral Breakpoints
Menu
@media screen and (min-width: 40em) { #menu-trigger { display : none; } }

Slide 206

Slide 206 text

Behavioral Breakpoints
Menu
@media screen and (min-width: 40em) { #menu-trigger { display : none; } } switch (display) { case 'block': menu.on(); break; case 'none': menu.off(); break; }

Slide 207

Slide 207 text

Behavioral Breakpoints
Menu
@media screen and (min-width: 40em) { #menu-trigger { display : none; } } switch (display) { case 'block': menu.on(); break; case 'none': menu.off(); break; }

Slide 208

Slide 208 text

Behavioral Breakpoints
Menu
@media screen and (min-width: 40em) { #menu-trigger { display : none; } } switch (display) { case 'block': menu.on(); break; case 'none': menu.off(); break; } Breakpoints only in your CSS. Not repeated in JavaScript. http://cloudfour.github.io/offCanvasMenu/ http://blog.cloudfour.com/behavioral-breakpoints/

Slide 209

Slide 209 text

http://www.flickr.com/photos/kk/230544325/ #4 Deliver different size s at different screen sizes

Slide 210

Slide 210 text

One SRC to rule all IMGs http://www.flickr.com/photos/vermininc/3182396114/

Slide 211

Slide 211 text

Two most common use cases

Slide 212

Slide 212 text

https://www.flickr.com/photos/whitehouse/8491445521

Slide 213

Slide 213 text

https://www.flickr.com/photos/whitehouse/8491445521 Resolution Switching Includes high-density (retina) images.

Slide 214

Slide 214 text

http://www.flickr.com/photos/barackobamadotcom/5795228030/

Slide 215

Slide 215 text

Art direction http://www.flickr.com/photos/barackobamadotcom/5795228030/

Slide 216

Slide 216 text

http://www.flickr.com/photos/barackobamadotcom/5795228030/ Art direction

Slide 217

Slide 217 text

http://www.flickr.com/photos/barackobamadotcom/5795228030/ Art direction

Slide 218

Slide 218 text

http://www.flickr.com/photos/barackobamadotcom/5795228030/ Art direction

Slide 219

Slide 219 text

http://www.flickr.com/photos/barackobamadotcom/5795228030/ Art direction

Slide 220

Slide 220 text

http://www.flickr.com/photos/barackobamadotcom/5795228030/ Art direction

Slide 221

Slide 221 text

Not simply cropping

Slide 222

Slide 222 text

Art direction: Images with text Sign In Account Get Email Español Shopping Bag Features New Arrivals Show Off Tees Backpacks Tech Toys 2/$30 & 2/$40 PINK Favorites Spin the Panty Wheel Tops All Tops Hoodies & Crews Tees & Tanks Bottoms All Bottoms Sweats Shorts Yoga PINK Loves Yoga Panties 5/$26 Styles 3/$33 Styles Shop by Style Bras All Bras Bandeaus & Bralettes 2/$42 Wear Everywhere Bras Bras 101 Swim Search

Slide 223

Slide 223 text

No good solutions

Slide 224

Slide 224 text

The standards process is slow moving but… http://www.flickr.com/photos/johnlamb/2576062549/

Slide 225

Slide 225 text

picture specification

Slide 226

Slide 226 text

The president giving an
award. The picture element

Slide 227

Slide 227 text

Srcset and Sizes This is what you should use 75% of the time! http://blog.cloudfour.com/dont-use-picture-most-of-the-time/

Slide 228

Slide 228 text

Srcset and Sizes A rad wolf Picture standard does not require you to use the picture element. This is what you should use 75% of the time! http://blog.cloudfour.com/dont-use-picture-most-of-the-time/

Slide 229

Slide 229 text

http://ericportis.com/posts/2014/srcset-sizes/

Slide 230

Slide 230 text

Responsive images are in some browsers NOW! Coming soon! Under consideration Unknown

Slide 231

Slide 231 text

No content

Slide 232

Slide 232 text

Picturefill Picturefill A responsive image polyfill Download Getting Started Examples API Browser support Contributing The picture element and associated features are W3C standard HTML features that allow web developers to deliver an appropriate image to every user depending on a variety of conditions like screen size, viewport size, screen resolution, and more. Picturefill is a JavaScript file (or a polyfill to be more specific) that enables support for the picture element and associated features in browsers that do not yet support them, so you can start using them today! Picturefill is developed and maintained by , with help from the members of the Responsive Images Community Group and the developer community at large. For Picturefill version 2, a special thanks goes to Shawn Jansepar for all his work on polyfilling the new spec. Contributing, Bug Reports, and More information For more information on the development of Picturefill, and how you can file bugs or contribute fixes, check out the the code project site on Github : Picturefill on Github. Downloading Picturefill Downloading Picturefill Picturefill Version 2.0.0 http://scottjehl.github.io/picturefill/

Slide 233

Slide 233 text

#5 Handle high-density images carefully

Slide 234

Slide 234 text

A single image on multiple screens

Slide 235

Slide 235 text

0 500000 1000000 1500000 2000000 Blackberry Curve iPhone iPhone Retina Macbook Macbook Retina 1861632 465408 519360 130080 57920 320x181 480x271 960x541 909x512 1818x1024 Image Resolution

Slide 236

Slide 236 text

0 500000 1000000 1500000 2000000 Blackberry Curve iPhone iPhone Retina Macbook Macbook Retina 1861632 465408 519360 130080 57920 320x181 480x271 960x541 909x512 1818x1024 Image Resolution 32x bigger

Slide 237

Slide 237 text

@media screen and (-webkit-device-pixel-ratio: 1) { /* Image for normal displays. */ #main { background-image: url(dog.jpg); } } @media screen and (-webkit-min-device-pixel-ratio: 2) { /* Image for high resolution displays. */ #main { background-image: (dog-hi-res.jpg); } } If possible, use CSS for now

Slide 238

Slide 238 text

Picturefill User Preference Branch https://github.com/scottjehl/picturefill/tree/user-prefs

Slide 239

Slide 239 text

Compressive images? http://blog.netvlies.nl/design-interactie/retina-revolution/

Slide 240

Slide 240 text

http://www.flickr.com/photos/fuzzylittlemanpeach/4633972431/ If I could dream up my ideal solution for images…

Slide 241

Slide 241 text

Eights guidelines for responsive images

Slide 242

Slide 242 text

#1 Use vector-based images whenever you can

Slide 243

Slide 243 text

A Compendium of SVG Information Published*July*22,*2014*by*Chris*Coyier CSS-TRICKS Grow your CSS skills. * THE LODGE A*huge*pile*of*information*about SVG. How to Use SVG These*are*overview*articles covering*lots*of*stuff*relating*to SVG.*Why*to*use*it*and*the*basics of*how*to*use*it.*Mostly:* ,* ,* , background-image ™ Learn*HTML,*CSS,*and*how*to*build iPhone*apps*at*Treehouse.*Their library*of*over*1,000*current*training FORUMS SNIPPETS ALMANAC VIDEOS BLOG http://css-tricks.com/mega-list-svg-information/

Slide 244

Slide 244 text

/' // . // |\//7 /' " \ . | ( \ _ _ - -_ | '._ ' _ __ _- \_ _/ \'-' // \\_/ \\ | | || | / / | \ / |VV ||--\__________/-||-/| || || || || { } { } { }{ } . . Drag & Drop ur SVGs on the Grumpicon plz. What Is This Issues? Grumpicon.com based on Grunticon

Slide 245

Slide 245 text

Media queries INSIDE SVG? http://www.flickr.com/photos/deleatur/3051737237

Slide 246

Slide 246 text

Simple SVG + mediaqueries #circle { fill: #fce57e; stroke: #fff; stroke-width: 100px; stroke-opacity: 0.5; fill-opacity: 1; } @media screen and (max-width: 350px) { #circle { fill: #879758; } } @media screen and (max-width: 200px) { #circle { fill: #3b9557; } } @media screen and (max-width: 100px) { #circle { fill: #d8f935; } } @media screen and (max-width: 50px) { #circle { fill: #a8c45f; } } @media screen and (max-width: 25px) { #circle { fill: #2c3c0c; } }

Slide 247

Slide 247 text

http://my.opera.com/ODIN/blog/2009/10/12/how-media-queries-allow-you-to-optimize-svg-icons-for-several-sizes

Slide 248

Slide 248 text

http://my.opera.com/ODIN/blog/2009/10/12/how-media-queries-allow-you-to-optimize-svg-icons-for-several-sizes

Slide 249

Slide 249 text

http://my.opera.com/ODIN/blog/2009/10/12/how-media-queries-allow-you-to-optimize-svg-icons-for-several-sizes

Slide 250

Slide 250 text

#2 Encourage people to upload the highest quality source possible

Slide 251

Slide 251 text

#3 Provide an automatic image resizing and compression service

Slide 252

Slide 252 text

Example from Sencha IO SRC. Define height, width or both. My constrained image #4 Images can be resized to any size with URL parameters

Slide 253

Slide 253 text

Example from Sencha IO SRC. Define height, width or both. My constrained image #4 Images can be resized to any size with URL parameters Unique URLs are imperative to play nice with caching.

Slide 254

Slide 254 text

No content

Slide 255

Slide 255 text

“Save for the Web” should be a thing of the past. —@adamdbradley “

Slide 256

Slide 256 text

#5 Provide automated output of Picture and PictureFill The president giving an award.

Slide 257

Slide 257 text

Responsive Images Markup Function

Slide 258

Slide 258 text

{ "source":"/source.jpg", "breakpoints": [ { "max-width":"30em","pixel-density":1,"width":360px }, { "max-width":"30em","pixel-density":2,"width":720px }, { "max-width":"30em","pixel-density":1,"width":800px }, { "max-width":"30em","pixel-density":2,"width":1600px }, { "pixel-density":1,"width":800px }, { "pixel-density":2,"width":1600px }, ] } Responsive Images Markup Function Templates contain breakpoint info only.

Slide 259

Slide 259 text

{ "source":"/source.jpg", "breakpoints": [ { "max-width":"30em","pixel-density":1,"width":360px }, { "max-width":"30em","pixel-density":2,"width":720px }, { "max-width":"30em","pixel-density":1,"width":800px }, { "max-width":"30em","pixel-density":2,"width":1600px }, { "pixel-density":1,"width":800px }, { "pixel-density":2,"width":1600px }, ] } Responsive Images Markup Function Responsive Images Markup Function Templates contain breakpoint info only. Markup for all images can be changed in one spot.

Slide 260

Slide 260 text

{ "source":"/source.jpg", "breakpoints": [ { "max-width":"30em","pixel-density":1,"width":360px }, { "max-width":"30em","pixel-density":2,"width":720px }, { "max-width":"30em","pixel-density":1,"width":800px }, { "max-width":"30em","pixel-density":2,"width":1600px }, { "pixel-density":1,"width":800px }, { "pixel-density":2,"width":1600px }, ] } Responsive Images Markup Function Responsive Images Markup Function PictureFill Markup Templates contain breakpoint info only. Markup for all images can be changed in one spot.

Slide 261

Slide 261 text

#6 Provide a way to override resized images for art direction needs

Slide 262

Slide 262 text

jpegtran or jpegoptim OptiPNG or PNGOUT far future expires headers learn from mod_pagespeed or use it #7 Integrate image compression best practices

Slide 263

Slide 263 text

The average WebP file size is 25% - 34% smaller compared to JPEG file size. WebP compresses 34% better than libpng, and 26% better than pngout for loseless images. #8 Bonus: Detect support for WebP image format and use it

Slide 264

Slide 264 text

It’s three years later. Let’s revisit my original question.

Slide 265

Slide 265 text

Can a one size fits all solution… http://www.flickr.com/photos/theyoungthousands/4025421438

Slide 266

Slide 266 text

compete with a tailored experience? http://www.flickr.com/photos/fronx/2862975043

Slide 267

Slide 267 text

http://www.flickr.com/photos/haddadi/5971508861 Or will it always be TOO BIG?

Slide 268

Slide 268 text

Unlikely responsive design will ever be as fast as something crafted specifically for a device. http://www.flickr.com/photos/quarenta/3256329577

Slide 269

Slide 269 text

But web design is a balancing act. http://www.flickr.com/photos/kalexanderson/6266452817

Slide 270

Slide 270 text

And performance is just one factor.

Slide 271

Slide 271 text

Flickr: Uploaded February 11, 2007 by hawridger For most projects, responsive design can be fast enough to make sense…

Slide 272

Slide 272 text

if we do the extra work to make mobile first responsive designs.

Slide 273

Slide 273 text

Thank You! Special thanks to Scott Jehl, Guy Podjarny, and all of the Flickr users sharing under creative commons.