Responsive Re-Engineering

63
Responsive Re- Engineering Aidan Ryan Silicon Valley Code Camp 2013

description

Reach the largest audience with the smallest code footprint by developing site designs that scale with the device. We take a tired, outdated design and update it for the modern, mobile web using responsive web design techniques with HTML5, CSS3, and . Discussion of the rationale for choosing responsive design, demos of implementation techniques, and highlights of tools and frameworks to aid the process. Special focus on responsive web design implementation in Visual Studio 2012 on ASP.NET MVC 4.

Transcript of Responsive Re-Engineering

Page 1: Responsive Re-Engineering

Responsive Re-EngineeringAidan RyanSilicon Valley Code Camp 2013

Page 2: Responsive Re-Engineering

“Best viewed with IE 5.5 at 800x600, color depth 15bpp, with a parakeet on your shoulder”

Page 3: Responsive Re-Engineering

Defining Responsive» Opposite of “prescriptive”» Responds to

» Browser capabilities» Device capabilities» User capabilities» Viewport size and orientation

Page 4: Responsive Re-Engineering

Core Techniques» Fluid Grid» Media queries» Responsive media

Page 5: Responsive Re-Engineering

Why?» Balance of effort and reach» Consistency» Value first» User joy

Page 6: Responsive Re-Engineering

Why Not?» Audience» Time/effort to benefit tradeoff» Need for highly-targeted designs» Use a subset of techniques / subset of site

Page 7: Responsive Re-Engineering

History

John Allsopp – A Dao of Web Design• April 2000

Jason Grigsby – CSS Media Query for Mobile is Fool’s Gold• August 2010

Approx. 2.9e+9 articles, galleries, samples, etc• April 2013

Page 8: Responsive Re-Engineering

Case Study: Before

Page 9: Responsive Re-Engineering

Case Study: Before

Page 10: Responsive Re-Engineering

Grid Systems» Fixed» Responsive» Fluid» Fluid + Responsive

Page 11: Responsive Re-Engineering

Framework Classification Max size Columns Notes

960gs Static 960px 12 / 16 Grid onlyIE7+CSS

Skeleton Responsive 960px (desktop/tablet-landscape)768px (tablet-portrait)420px (mobile-landscape)300px (mobile-portrait)

16 Lightweight CSS frameworkIE7+CSS

responsive.gs

Fluid + Responsive

AnyColumns stack below 768px

12 / 16 / 24 Grid onlyIE7+CSS

Bourbon Neat

Fluid + Responsive

Fluid + Responsive 12(or custom)

Grid addon to BourbonIE9+Sass

Bootstrap Static ORFluid ORFluid + Responsive

Static: 940pxOthers: Any (nestable)

16 Full client-side frameworkIE6+LESS

Page 12: Responsive Re-Engineering

Media Queries» CSS3» All about width» Mobile first? Desktop first?» Select breakpoints» Size, move, hide, replace, or transform?

<meta name="viewport" content="width=device-width" />

@media only screen and (max-width: 40em) {}

Page 13: Responsive Re-Engineering

Viewport

width=device-width Defaults

Page 16: Responsive Re-Engineering

Four…

Page 17: Responsive Re-Engineering

Six…?!?!

Page 18: Responsive Re-Engineering

The “Goldilocks” Approach

Credit: Chris Armstrong

Page 19: Responsive Re-Engineering

Responsive Media» Images

» Scale, crop, swap, omit?» SVG

» Video» Scale» HTML5 <video>, Flash» Download alternatives

» Audio» Scale» HTML5 <audio>, Flash» Download alternatives

Page 20: Responsive Re-Engineering

Responsive Images» Scale and Crop» Swap and Omit» SVG» Choose the right format» Encoding quality

Page 21: Responsive Re-Engineering

Responsive Video<div id="video-container"> <video controls="controls" width="1280" height="720" title="vid" poster="x.jpg"> <source src="small.mp4" type="video/mp4" media="all and (max-width:480px)" /> <source src="file.webm" type="video/webm" /> <source src="file.mp4" /> <object …> <a href="file.mp4“><img src="x.jpg“/> Download video</a> </object></video></div>

$('#vid-container').fitVids(); // OR CSS

Page 22: Responsive Re-Engineering

Responsive Forms» Label alignment» Touch-friendly» Input types

“To order a special dialing wand, please mash the keypad with your palm now.”

Page 23: Responsive Re-Engineering

Typography» Respect the user agent» Display density» Metrics: font size, contrast, line height,

line length, spacing, hyphenation» “A useful trick is to hold a well-printed book

at a comfortable reading distance while looking at your website to compare.” – attrib

» Web fonts – browser and device quirks

Source: BrightLemon.com

Page 24: Responsive Re-Engineering

Fonts – Browser Quirks and Gotchas

Chrome 23 IE10 Firefox 16 Android 4.1

Selectedtext-shadow

Page 25: Responsive Re-Engineering

Other Techniques» Mobile click event latency (touch events)» Keyboard hotkeys» Bundling and minification (System.Web.Optimization)

Page 26: Responsive Re-Engineering

Case Study Workflow» Value» Content» Wireframe» Enhance, enhance, enhance

Page 27: Responsive Re-Engineering

Case Study: Before

Page 28: Responsive Re-Engineering

Step One: Focus on Value» Identify your user» Identify the primary reason the

user is visiting» Identify the activities that will

engage the user

http://xkcd.com/773/

Page 29: Responsive Re-Engineering

Case Study Step One» Users

» Repeat visitors » Organic search» Active search

» Reasons» Repeats: hear old and new sounds» Organic searchers: He-Man» Active searchers: hear sounds, read info

» Activities» Play music» View pictures» Read copy

Page 30: Responsive Re-Engineering

Step Two: Collect Content» Isolate your copy» Curate your copy» Isolate your media» Curate your media» Process your media

Page 31: Responsive Re-Engineering
Page 32: Responsive Re-Engineering
Page 33: Responsive Re-Engineering
Page 34: Responsive Re-Engineering

Case Study Step Two: Result» Copy: isolated, culled, consistently

named» Image sets: sorted, culled, consistently

named, full-size and scaled» Audio: sorted, culled, consistently

named, with ID3» Video: full-bitrate and downsampled

Page 35: Responsive Re-Engineering

Step Three: “Sweet Spot” Wireframes and Typography

» Index card sitemap» Paper sketches / storyboard» Move to HTML Skeleton ASAP» CSS Reset» Type ramp

Page 36: Responsive Re-Engineering
Page 37: Responsive Re-Engineering
Page 38: Responsive Re-Engineering
Page 39: Responsive Re-Engineering
Page 40: Responsive Re-Engineering
Page 41: Responsive Re-Engineering
Page 42: Responsive Re-Engineering
Page 43: Responsive Re-Engineering

MVC 4 Skeleton» Start with “Empty” project» Strip out Web API and other unneeded NuGet packages» Add the master layout

» Style bundle (normalize.css + site.css)» HTML5shiv» Minimal layout

Page 44: Responsive Re-Engineering

@using System.Web.Optimization<!DOCTYPE html><html><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width">

<title>Masters of the Universe</title>

@Styles.Render("~/CSS/styles") <!--[if lt IE 9]> <script src="~/JavaScript/html5shiv.js"></script> <![endif]--></head><body> <div class="page-center"> <header> <div class="hero">@RenderSection("hero", true)</div> <h1 class="logo">Masters of the Universe</h1> </header> @RenderBody() </div></body></html>

Page 45: Responsive Re-Engineering
Page 46: Responsive Re-Engineering
Page 47: Responsive Re-Engineering
Page 48: Responsive Re-Engineering

Step Four: Enhance Layout for Mobile» Position» Type Size» Padding/Margins» Remove non-essentials

Page 49: Responsive Re-Engineering

Before

Page 50: Responsive Re-Engineering

After

Page 51: Responsive Re-Engineering

At the breakpoint

Page 52: Responsive Re-Engineering

Step Five: Enhance Layout for Wide Desktop» Position» Type Size» Avoid content islands» Creative use of space

Page 53: Responsive Re-Engineering
Page 54: Responsive Re-Engineering
Page 55: Responsive Re-Engineering

Step Six: Detailed Styling and Interactions» Textures, shadows» Touch, input types

Page 56: Responsive Re-Engineering
Page 57: Responsive Re-Engineering
Page 58: Responsive Re-Engineering
Page 59: Responsive Re-Engineering
Page 60: Responsive Re-Engineering
Page 61: Responsive Re-Engineering
Page 62: Responsive Re-Engineering

Test, test, test» Testing tools

» WatiN / Selenium» Device simulation

» BrowserStack» Electric Mobile Studio» Mobilizer» VirtualBox» Simulators will only take you so far

Page 63: Responsive Re-Engineering

Samples» https://github.com/ajryan/CodeCamp2013 (Code)» http://codecampresponsive.apphb.com (Live demos)» http://mastersband.apphb.com (Responsive re-design)