An Introduction to Responsive Design

89

description

Responsive design is a combination of techniques aiming to create interfaces able to adapt to a wide range of devices, optimising the user experience in each of them but using the same code-base. But responsive design is not just about technology, as it also requires a different way of thinking and planning the development of interfaces.

Transcript of An Introduction to Responsive Design

Page 2: An Introduction to Responsive Design

Henrik Ekelöf @henrikekelof

Robert Piirainen @robertpiira

Page 3: An Introduction to Responsive Design

‣ Introduction to Responsive

Design

‣ Answering common questions

‣ The way forward is flexibility,

not adapting to popular devices

Page 4: An Introduction to Responsive Design

Responsive Design

Page 5: An Introduction to Responsive Design

- A new cool way to build mobile web

What it is:

Page 6: An Introduction to Responsive Design

In fact:

Page 7: An Introduction to Responsive Design

is no

Page 8: An Introduction to Responsive Design

There is not a specific Web

for mobile devices.

It’s the same web.

Page 9: An Introduction to Responsive Design
Page 10: An Introduction to Responsive Design

640 x 480 640 x 480

800 x 600 800 x 600

1024 x 768 1024 x 768

Page 11: An Introduction to Responsive Design
Page 12: An Introduction to Responsive Design

1024 x 768

320 x 480

Page 13: An Introduction to Responsive Design
Page 14: An Introduction to Responsive Design

1024 x 768

320 x 480

768 x 1024

Page 15: An Introduction to Responsive Design
Page 16: An Introduction to Responsive Design

The web has moved beyond

the desktop, and it’s not turning

back.

Page 17: An Introduction to Responsive Design
Page 18: An Introduction to Responsive Design

whatever device or screen size

Page 19: An Introduction to Responsive Design

Responsive

Design

Flexible grids Flexible

media

Media

queries

Page 20: An Introduction to Responsive Design

Grid Layout

Page 21: An Introduction to Responsive Design
Page 22: An Introduction to Responsive Design
Page 23: An Introduction to Responsive Design
Page 24: An Introduction to Responsive Design
Page 25: An Introduction to Responsive Design

Flexible Media

Page 26: An Introduction to Responsive Design

img {

max-width: 100%

}

Page 27: An Introduction to Responsive Design

Media

Queries

CSS3

Page 28: An Introduction to Responsive Design
Page 29: An Introduction to Responsive Design

widthheightdevice-widthdevice-heightorientationaspect-

ratiodevice-aspect-ratiocolor...

Queries

Page 30: An Introduction to Responsive Design

320px

480px

768px

1024px

1200px

Breakpoints

Page 31: An Introduction to Responsive Design

Flexible grids Flexible

media

Media

queries

Page 32: An Introduction to Responsive Design

Problems and

Solutions

Page 33: An Introduction to Responsive Design

Wallpapers

Page 34: An Introduction to Responsive Design
Page 35: An Introduction to Responsive Design
Page 36: An Introduction to Responsive Design
Page 37: An Introduction to Responsive Design
Page 38: An Introduction to Responsive Design

Optimisation of

background images

in CSS ‣ Use Data URIs for images to be

displayed in all sizes

Page 39: An Introduction to Responsive Design

li { background:

url("data:image/gif;base64,R0lGODlhEAAQAMQAAORHH

OVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfj

Z0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5B

AkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fi

yZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUh

wFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCB

MQiB0UjIQA7") no-repeat left center;}

Page 40: An Introduction to Responsive Design

Optimization of

background images

in CSS ‣ Use Data URIs for images to be

displayed in all sizes

‣ Use sprites

Page 41: An Introduction to Responsive Design

Sprites

Page 42: An Introduction to Responsive Design

Optimisation of background

images in CSS

‣ Use Data URIs for images to be

displayed in all sizes

‣ Use sprites

‣ Do not mix images for different screen

widths in the same sprite

Page 43: An Introduction to Responsive Design

Inline Pictures

Page 44: An Introduction to Responsive Design
Page 45: An Introduction to Responsive Design
Page 46: An Introduction to Responsive Design
Page 47: An Introduction to Responsive Design
Page 48: An Introduction to Responsive Design

Content Optimisation

images

‣ Use “Lazy Load” if you have many (or

large) images that only appear on

certain screen widths.

Page 49: An Introduction to Responsive Design

<img src="pixel.gif" data-original="example.jpg">

<img src="example.jpg">

Page 50: An Introduction to Responsive Design

Content Optimisation

images

‣ Use “Lazy Load” if you have many (or

large) images that only appear on

certain screen widths.

‣ Resize images on the server

Page 51: An Introduction to Responsive Design

<!DOCTYPE html>

<html>

<head>

<script>

document.cookie = 'resolution=' +

Math.max(screen.width, screen.height) +

'; path=/';

</script>

</head>

<body>

<img src="example.jpg" alt="">

Page 52: An Introduction to Responsive Design

Pictures

‣ The background images downloaded

‣ All inline images downloaded regardless

of whether they are shown or not

Page 53: An Introduction to Responsive Design

Legacy versions of

Internet Explorer (IE8 and older)

Page 54: An Introduction to Responsive Design

/* Style for small screens and basic style for all */.example { ... }@media

all and (min-width: 321px) {

/* Style for a slightly wider device (like the iPhone portrait) */ .example

{ ... }

}

@media all and (min-width: 481px) {

/* Style for a even wider device (like the iPhone landscape) */

.example { ... }

}

@media all and (min-width: 769px) {

/* Style for wide screens */ .example { ... }

}

Page 55: An Introduction to Responsive Design

<!DOCTYPE html>

<html>

<head>

<!--[if (gte IE 9)|!(IE)]><!-->

<link rel="stylesheet" href="rwd.css">

<!--<![endif]-->

<!--[if (lte IE 8)]>

<link rel="stylesheet" href="rwd-ie.css">

<![endif]-->

...

Page 56: An Introduction to Responsive Design

Responsive by design

Page 58: An Introduction to Responsive Design
Page 59: An Introduction to Responsive Design
Page 60: An Introduction to Responsive Design
Page 61: An Introduction to Responsive Design

We

should embrace the fact that the web

doesn’t have the same constraints,

and design for this flexibility.

Page 62: An Introduction to Responsive Design

The journey begins by letting go of

control, and becoming flexible.

Page 63: An Introduction to Responsive Design

A flexible web!

Page 64: An Introduction to Responsive Design

A flexible web

‣ Large variations in screen resolutions

Page 65: An Introduction to Responsive Design

Top 10 screen resolutions in Sweden during the last year

Page 66: An Introduction to Responsive Design

‣ Large variations in screen

resolutionsVarious devices with different

characteristics

A flexible web

Page 68: An Introduction to Responsive Design

Priority: 1

As an increasing variety of screen and window

sizes among users is the best solution to create a

layout that is flexible and can adapt to user's

needs and wishes. Avoid making a site with fixed

layout.

— 24-hour WebCreate a design that works

regardless of window and screen size

Page 69: An Introduction to Responsive Design

Mobile First

Strategy?

Page 70: An Introduction to Responsive Design
Page 71: An Introduction to Responsive Design

Losing 80% of your screen space forces

you to focus. You need to make sure that

what stays on the screen is the most

important set of features for your

customers and your business.

Page 72: An Introduction to Responsive Design

Semantically, meaningful markup

Separate design and layout

Introduce layout styles with media queries

"Mobile" CSSs + media queries = Desktop site

Responsive

design

Page 73: An Introduction to Responsive Design

http://www.flickr.com/photos/merlin/sets/72157622077100537/

Page 74: An Introduction to Responsive Design

Responsive

Tools

Page 75: An Introduction to Responsive Design
Page 76: An Introduction to Responsive Design

‣ Rendering of font differs depending on

browsers and operating systems

‣ Different browsers

‣ Impossible to visualize a responsive

layout

Page 77: An Introduction to Responsive Design
Page 78: An Introduction to Responsive Design
Page 80: An Introduction to Responsive Design
Page 82: An Introduction to Responsive Design

a

responsive

process

Page 83: An Introduction to Responsive Design
Page 84: An Introduction to Responsive Design
Page 85: An Introduction to Responsive Design
Page 86: An Introduction to Responsive Design
Page 87: An Introduction to Responsive Design
Page 88: An Introduction to Responsive Design

Summary

‣ Introduction to Responsive

DesignAnswering common

questions

‣ The way forward is flexibility,

not adapting to popular devices

Page 89: An Introduction to Responsive Design

Henrik Ekelöf @henrikekelof

Robert Piirainen @robertpiira