34
Musketeers.me Responsive Development Kevin Bruce of Musketeers.me

Responsive Development (ZendCon 2012)

Embed Size (px)

DESCRIPTION

Responsive Design is the buzz in design, but as we all know, design is only part of the story. With the arrival of the HTML5, CSS3 and javascript triumvirate we can no make truly immersive mobile and desktop browser experiences. Coupled with modern PHP web application practices, your web app will feel and act closer to a native app, at a fraction of the cost. In this presentation, we'll dive into designing your modern web application to take advantage of as much of the platforms' limitations and advantages. Sure, you can't use the camera, but in many cases can use the accelerometer, and it'll always be granted to look right, any angle you look at it! These days, there's no excuse for not having a "mobile version" when all you need is one site that can transform itself to suit the device!

Citation preview

Page 1: Responsive Development (ZendCon 2012)

Musketeers.me

Responsive Development

Kevin Bruce of Musketeers.me

Page 2: Responsive Development (ZendCon 2012)

2Musketeers.me

Who Am I?

DesignerDeveloper

Page 3: Responsive Development (ZendCon 2012)

3Musketeers.me

Where I Work

Page 4: Responsive Development (ZendCon 2012)

Musketeers.me

THE Question:Is a responsive site the best

way to go for my site?

Page 5: Responsive Development (ZendCon 2012)

5Musketeers.me

Options

Full Responsive Site Dedicated Mobile Site

Native Application

Musketeers.me

Page 6: Responsive Development (ZendCon 2012)

6Musketeers.me

Full Responsive Site

Benefits

• One Codebase

• Same html file serves all devices

Drawbacks

• Not completely tailored to any device

• Unless you have a process in place, it can take as much time to write as a separate mobile site

Musketeers.me

Page 7: Responsive Development (ZendCon 2012)

7Musketeers.me

Dedicated Mobile Site

Benefits

• Cater to mobile content needs like Location and contact info

• Can concentrate on touch-based UI

Drawbacks

• Completely separate codebase and content to maintain

• Studies have shown that a separate “paired-down” site pisses people off.

Musketeers.me

Page 8: Responsive Development (ZendCon 2012)

8Musketeers.me

Native Mobile App

Benefits

• Native access to device hardware

• Interface is more responsive

Drawbacks

• Development cost is high to write and maintain

• At least two mobile Operating Systems to write for

Page 9: Responsive Development (ZendCon 2012)

9Musketeers.me

My Own Personal Decision-Makers

Responsive Site

• Information Website

• Light Interactive Website

Dedicated Mobile Site

• Shopping Cart

• Login-Based Website

Native Application

• Full Web Application

• Giant Shopping Cart

Page 10: Responsive Development (ZendCon 2012)

Musketeers.me

Responsive Design

Page 11: Responsive Development (ZendCon 2012)

11Musketeers.me

In a Nutshell

flexible grid layouts that respond to the size of your browser window (viewport).

Page 12: Responsive Development (ZendCon 2012)

12Musketeers.me

Flexible Grid is the Key to Responsive Design

A flexible grid is made up of fluid columns and rows that use ems and percentages for setting

width, height, font-size, image and media sizes.

Page 13: Responsive Development (ZendCon 2012)

13Musketeers.me

Media Queries

Media Queries are a CSS3 feature that was introduced into the modern browser. It is a series of “break points” based on your browser window (or “viewport”) size.

Your browser only uses the styles within the breakpoint that matches your viewport size. Of course, it also uses styles outside of any breakpoints as well.

Page 14: Responsive Development (ZendCon 2012)

14Musketeers.me

Media Queries

1. Use the @import rule to import styles from other style sheets:

<div id=”google_whitespace” style=”@import url(style600min.css) screen and (min-width: 600px);”></div>

Page 15: Responsive Development (ZendCon 2012)

15Musketeers.me

Media Queries

2. Put media queries directly in the style sheet. This is the most common approach. @media screen and (min-width: 400px) and (orientation: portrait) {                #nav li {                    float: right;                }        }@media screen and (min-width: 800px) {             #nav li {                 float: left;  } }

Page 16: Responsive Development (ZendCon 2012)

16Musketeers.me

Media Queries

3. Include a query in a linked style sheet’s media attribute:

<link rel="stylesheet"  type="text/css"  media="screen and (max-device-width: 800px)" href="style800.css" />

Page 17: Responsive Development (ZendCon 2012)

17Musketeers.me

Mobile First

Depending on who you talk to, mobile-first is the way to go.

Design for mobile, serve the mobile breakpoints first and then progressively enhance from there for larger viewports.

Use “min-width” breakpoints so the larger screens inherit styles from the smaller viewport break points, in effect, cascading up.

body { … }

mobile

tablet

desktop

@media only screen and (min-width: 200px)

@media only screen and (min-width: 1020px)

@media only screen and (min-width: 1450px)

style.css

Page 18: Responsive Development (ZendCon 2012)

18Musketeers.me

Mobile Content First

The important take-away from mobile-first is “content-first.”

Distill your message down to the essentials!

Start with the content you would show in your mobile view and add in the Design cruff from there.

Also, write semantic markup!

Page 19: Responsive Development (ZendCon 2012)

Musketeers.me

Responsive Development

Page 20: Responsive Development (ZendCon 2012)

20Musketeers.me

Server side is an alternate, powerful tool to help support your responsive front end strategy.

User Agent Detection can tell you if a device is using a mobile browser, as well as “The IE.”

Server Side Help

Page 21: Responsive Development (ZendCon 2012)

21Musketeers.me

Server Side User Agent Detection can help your responsive front end strategy. With it, your code can help mobile and tablet pages by:

• Compacting javascript and styles, insert them directly into the html page and serve them as one document, lessening the server trips.

Server Side Help

Page 22: Responsive Development (ZendCon 2012)

22Musketeers.me

Server Side User Agent Detection can help your responsive front end strategy. With it, your code can help mobile and tablet pages by:

• Compacting javascript and styles, insert them directly into the html page and serve them as one document, lessening the server trips.

• Server touch-based javascript for touch devices and omit unneeded code.

Server Side Help

Page 23: Responsive Development (ZendCon 2012)

23Musketeers.me

Server Side User Agent Detection can help your responsive front end strategy. With it, your code can help mobile and tablet pages by:

• Compacting javascript and styles, insert them directly into the html page and serve them as one document, lessening the server trips.

• Server touch-based javascript for touch devices and omit unneeded code.

• Embed images with Data URIs for mobile (http://css-tricks.com/data-uris/).

Server Side Help

Page 24: Responsive Development (ZendCon 2012)

24Musketeers.me

Server Side User Agent Detection can help your responsive front end strategy. With it, your code can help mobile and tablet pages by:

• Compacting javascript and styles, insert them directly into the html page and serve them as one document, lessening the server trips.

• Server touch-based javascript for touch devices and omit unneeded code.

• Embed images with Data URIs for mobile (http://css-tricks.com/data-uris/).

• Serve correctly sized images for the device.

Server Side Help

Page 25: Responsive Development (ZendCon 2012)

Musketeers.me

The IE

Page 26: Responsive Development (ZendCon 2012)

26Musketeers.me

• IE 6: it sucks, but government still has a lot of internal systems that only work on it, so…

• IE 7: Sucks less, but few rely on it for internal systems (see IE 6)

• IE 8: really a step in the right direction, but it doesn’t support media queries or html5… and many CSS3 features.

• IE 9: This is the big improvement! Standards compliant… sort of (it’s all relative, isn’t it?). HTML5, media queries- all good!

• IE 10: reported to be awesome with web standards (really!)… and sooo many people don’t have it yet.

State of IEEEEEEE

Page 27: Responsive Development (ZendCon 2012)

27Musketeers.me

IE 8 and below can usually be taught html5 and media queries with the help of a couple of javascripts:

1. Modernizer.js teaches pre-HTML5 browsers to see the new HTML5 tags as block elements.(http://modernizr.com)

2. Respond.js teaches IE what media queries are and how to use them.(https://github.com/scottjehl/Respond)

IE retrofits

Page 28: Responsive Development (ZendCon 2012)

Musketeers.me

What can we do with a mobile device?

Page 29: Responsive Development (ZendCon 2012)

29Musketeers.me

Hardware We Can Access Varies

Page 30: Responsive Development (ZendCon 2012)

30Musketeers.me

HTML5 standards opened up access to much of device hardware. And more and broader support is coming.

• Solid support for the accelerometer and GPS in both iOS and Android.

• Access to the GPU (WebGL) and audio hardware (Web Audio API).

• Access to the camera (HTML Media Capture) is a very new feature and has full support in Android 3.0 and limited support in iOS6 Safari and Chrome.

Hardware We Can Access Varies

Page 31: Responsive Development (ZendCon 2012)

31Musketeers.me

Facebook’s stint with an html5 app was universally panned. The roars of applause were deafening when the native app was released.

So… no, you shouldn’t try to imitate a native app with responsive design. You will most likely fail.

Are we there yet?

Page 32: Responsive Development (ZendCon 2012)

32Musketeers.me

The one thing Facebook did accomplish was the responsive site was a good test case. Responsive Design is good prototype for the native app.

…provided you don’t drive them away in the process.

Slap “Beta” on it!

However…

Page 33: Responsive Development (ZendCon 2012)

33Musketeers.me

MOBILE-FIRSThttp://www.html5rocks.com/en/mobile/responsivedesign/

A NON-RESPONSIVE APPROACH TO BUILDING CROSS-DEVICE WEBAPPShttp://www.html5rocks.com/en/mobile/cross-device/

CAPTURING AUDIO & VIDEO IN HTML5http://www.html5rocks.com/en/tutorials/getusermedia/intro/

CREATING A MOBILE-FIRST RESPONSIVE WEB DESIGNhttp://www.html5rocks.com/en/mobile/responsivedesign/

CONDITIONAL LOADING FOR RESPONSIVE DESIGNhttp://24ways.org/2011/conditional-loading-for-responsive-designs

Good Resources

Page 34: Responsive Development (ZendCon 2012)

34Musketeers.me

Thank You

Personal Site:kevinbruce.com

musketeers.meProfessional Site:

neutralgood.netBlog:

@kevinbruceTwitter:

https://joind.in/6866Rate me: