Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.

For the best experience please use the latest Chrome, Safari or Firefox browser.

Responsive Web Design

Tools and Techniques

Responsive Web Design

Matias Figueroa

UI Developer

Software Designer @ Globant

Likes to make stuff...


matias.figueroa@globant.com

@matixfigueroa

github.com/matix

matixfigueroa.com

matixfigueroa.com

What's Responsive Web Design?

Responsive Web Design (RWD) is a Design Strategy that aims to provide a deeply contextualized experience for the user regardless of the consumption device that is currently being used to access our site.

Mobile Design is centered on devices.

Responsive Design is centered on context.


This talk is about
The Web.

Responsive Design is also applicable to Native Mobile Apps.

(That's another talk.)

Some Basics:

RWD is for:

The pillars of RWD:

Feature Detection

Browser Sniffing

Are you using Chrome v32.0 on Mac?

vs.

Feature Detection

Does your browser support html5 video?

Wait... What?
Modernizr Logo
Modernizr Logo

Modernizr is a feature detection library thats runs tests against the context of your application and tells you what features are available for you to use.

It also helps you to load fallbacks for features that are not present.

Set it up...

Profit!

/* Simulated box shadow using borders: */ .box { border-bottom: 1px solid #666; border-right: 1px solid #777; } .boxshadow div.box { border: none; -webkit-box-shadow: #666 1px 1px 1px; -moz-box-shadow: #666 1px 1px 1px; box-shadow: #666 1px 1px 1px; }

Detect, Use/Degrade:

if(Modernizr.localstorage) { localstorage.setItem("lastUser", currentUser); } else { // Optional, don't scare your users // if is not important! showWarning("Your browser is not able " +"to remember your session."); }

Detect, Polyfill, Use:

Modernizr.load({ test: Modernizr.localstorage, nope:["localstorage-polyfill.js"], complete: function(){ localstorage.setItem("lastUser", currentUser); } });

Media queries

@media

@media screen

@media print

@media screen and
(min-width: 800px)

Breakpoints:

@media print
@media screen and (min-width: 1024px)
@media screen and (min-width: 960px)
@media screen and (min-width: 800px)
base styles (no @media)

This is not carved in stone... research your target breakpoints.

Careful...

@media print
@media screen and (min-device-width: 1024px)
@media screen and (min-device-width: 960px)
@media screen and (min-device-width: 800px)
base styles (no @media)

...devices lie... sometimes twice.

... or just

and forget about it.

Actually...

@media print
@media screen and (min-width: 1024px)
@media screen and (min-width: 960px)
@media screen and (min-width: 800px)
base styles (no @media)

We care about context, not devices.

@media screen and (min-width: 1024px) { /* Widescreen */ body { font-size: 1.5em; } .navigation { float: left; width:30%; } .content { float: left; width:70%; } }
@media screen and (min-device-width: 800px) { /* Narrow Screen */ body { font-size: 1em; } .navigation { width:100%; } .content { width:100%; } }

Even Better:

Much more:

width height
device-width device-height
aspect-ratio device-aspect-ratio
color monochrome color-index
resolution orientation
scan grid

... and more coming...

Fluid Grids

Remember when we used tables for layout?

Enter the grid:

A grid-based layout lets us distribute content in columns and rows, just like with a table.

But:

So many options:


... etc ...

See it in action:

Demo Time!

See it in action:

Demo Time!

Responsive Images

img { width:100%; }

Booya! Responsive, bitch...

Ok... not so easy...

Heaven:


We're not in heaven...

Picturefill

srcset-polyfill

Background Images

Retina Displays

Background Images (HiDPI)

Icon Fonts!

So Basically:

Nice read:

Smashing Magazine - The State of Responsive Design

Thanks!

Now go make some awesome websites.


These slides:

github.com/matix/rwd-tools

matix.github.io/rwd-tools

matix.github.io/rwd-tools

Use a spacebar or arrow keys to navigate