30
Elements of Responsive Web Design

Mobile Monday Presentation: Responsive Web Design

  • Upload
    cantina

  • View
    1.214

  • Download
    0

Embed Size (px)

DESCRIPTION

Real world aspects of implementing flexible, mobile and future-friendly sites through responsive design.

Citation preview

Page 1: Mobile Monday Presentation: Responsive Web Design

Elements ofResponsiveWeb Design

Page 2: Mobile Monday Presentation: Responsive Web Design

“So, I’ve been hearing aboutResponsive Web Design.

What is it, exactly?”

Page 3: Mobile Monday Presentation: Responsive Web Design

– Ethan Marcotte,Responsive Web Design

“We can embrace the flexibility inherent to the web, without surrendering the control we require as designers. All by embedding standards-based technologies in our work, and by making a slight change in our philosophy toward online design.”

Page 4: Mobile Monday Presentation: Responsive Web Design

We can use the fluidity of HTML, CSS and Javascript to create designs that provide

optimal experiences by responding to device context.

Page 5: Mobile Monday Presentation: Responsive Web Design

“Ok, but why should I care aboutResponsive Web Design?”

Page 6: Mobile Monday Presentation: Responsive Web Design

For years, we designed for this…

Page 7: Mobile Monday Presentation: Responsive Web Design

…and then this happened.

Page 8: Mobile Monday Presentation: Responsive Web Design

Responsive Web Design gives us the tools to handle the ever-increasing number of devices

in the wild in a future-friendly* fashion.

http://futurefriend.ly/

Page 9: Mobile Monday Presentation: Responsive Web Design

“Well, how do I implement a responsive site?”

Page 10: Mobile Monday Presentation: Responsive Web Design

Elements of Responsive Design

1Fluid Grids

Fg2

Flexible Images

Fi3

Media Queries

Mq

Page 11: Mobile Monday Presentation: Responsive Web Design

Here’s some basic, responsive boilerplate

<!DOCTYPE html> <html><head>

<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">

</head><body>

…</body></html>

Page 12: Mobile Monday Presentation: Responsive Web Design

Let’s add a simple grid<!DOCTYPE html> <html><head>

<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" href="grid.css">

</head><body>

<div class="grid"><div class="col-2-3">

…</div><div class="col-1-3">

…</div>

</div></body></html>

Hat tip to @chriscoyier and http://css-tricks.com/dont-overthink-it-grids/

Page 13: Mobile Monday Presentation: Responsive Web Design

And now some styles to make the grid work

*, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}.grid { padding: 1em 0 1em 1em }.grid:after { content: ""; display: table; clear: both;}

[class*='col-'] { float: left; padding-right: 1em;}.col-2-3 { width: 66.66% }.col-1-3 { width: 33.33% }

Hat tip to @chriscoyier and http://css-tricks.com/dont-overthink-it-grids/

Page 14: Mobile Monday Presentation: Responsive Web Design

Fluid grids scale to the device…

…but our layout doesn’t quite work.

Page 15: Mobile Monday Presentation: Responsive Web Design

Let’s use a media query to refine the layout.

*, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}.grid { padding: 1em 0 1em 1em }.grid:after { content: ""; display: table; clear: both;}

[class*='col-'] { float: left; padding-right: 1em;}

@media screen and (min-device-width: 480px ) { .col-2-3 { width: 66.66% } .col-1-3 { width: 33.33% }}

Hat tip to @chriscoyier and http://css-tricks.com/dont-overthink-it-grids/

Page 16: Mobile Monday Presentation: Responsive Web Design

And now the layout responds accordingly.

Two columns about @ 480px and aboveSingle column below 480px

Page 17: Mobile Monday Presentation: Responsive Web Design

Now, let’s make our images flex.

*, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}.grid { padding: 1em 0 1em 1em }.grid:after { content: ""; display: table; clear: both;}

[class*='col-'] { float: left; padding-right: 1em;}

img { max-width: 100% } // yep, that’s it

@media screen and (min-device-width: 480px ) { .col-2-3 { width: 66.66% } .col-1-3 { width: 33.33% }}

Page 18: Mobile Monday Presentation: Responsive Web Design

And now our images can flex with the layout.

Two columns about @ 480px and aboveSingle column below 480px

Page 19: Mobile Monday Presentation: Responsive Web Design

Of course, this requires scaling a single, larger image.

There’s a lot of work going on to find better solutions for flexible images, such as the

<picture> element.

Page 20: Mobile Monday Presentation: Responsive Web Design

There’s a lot more to it, but that covers the basics* of Responsive Web Design.

*Your mileage may vary. Support for IE quirks will require more work!

Page 21: Mobile Monday Presentation: Responsive Web Design

Buzz phrases to consider when thinking responsively

Mobile FirstDesign for the constraints of mobile devices first and craft your design to respond as capabilities increase.

Content OutDesign responsive sites around content needs.

Progressive EnhancementStart with a simple core and add features when capabilities appear on various devices.

Speed WinsDesign for the fastest display you can; eject everything you don’t need.

Page 22: Mobile Monday Presentation: Responsive Web Design

Jeffrey Zeldman,Responsive Design. I don’t think that word means what you think it means.http://bit.ly/oP8eei

“...the purpose behind “responsive design”—the concept of what it strives to achieve—should be separated from the specific techniques used to achieve it. As the worldwide community embraces [Ethan’s] idea (and as new methods of CSS layout become practical), the techniques of responsive design will continue to improve and, dare I say it, adapt.”

Page 23: Mobile Monday Presentation: Responsive Web Design

The original concept is fine, but it only addresses some needs. We need to broaden

our notion of ‘responsive’.

Page 24: Mobile Monday Presentation: Responsive Web Design

Other approaches to being responsive

Adaptive Web Designhttp://www.lullabot.com/articles/responsive-adaptive-web-design

RESS: Responsive Design + Server Side Componentshttp://www.lukew.com/ff/entry.asp?1392

Page 25: Mobile Monday Presentation: Responsive Web Design

Some Responsive Design Tools

Adobe Shadowlabs.adobe.com/technologies/shadow/

AptusIn the Mac App Store

Firefox 15getfirefox.com

Gridsetgridsetapp.com

ZURB Foundationfoundation.zurb.com

Page 26: Mobile Monday Presentation: Responsive Web Design

“Ok, I get it!So all of my sites should be

responsive from now on, right?”

Page 27: Mobile Monday Presentation: Responsive Web Design

YES

Page 28: Mobile Monday Presentation: Responsive Web Design

Ok, maybe not “always”.

Ask your doctor if an alternative approachmay be right for you.

Page 29: Mobile Monday Presentation: Responsive Web Design

Thanks!Questions?

Page 30: Mobile Monday Presentation: Responsive Web Design

Principal Consultant, Mobile Practice Lead

[email protected]@stonehippo

George White