Responsive Design

Drupal on a bunch of devices

a presentation by Geoffrey Roberts
Saturday, 14th January 2012

g.roberts@blackicemedia.com
geoffrey@crossfunctional.net
@retrovertigo

A brief introduction

Image of the first website

This site is optimised for

Netscape Navigator logo Internet Explorer logo

Forget this, let's use Flash

Flash logo

Web Standards

The Mobile Divide

A pile of mobile phones

Responsive Design

What is Responsive Design?

Yes, but really

What is Responsive Design?

Look at your website

This is a desktop computer

Now look at your mobile

This is a bunch of mobile phones

Now look at this older computer

Now look at this tablet

Now look at this huge screen

This is a TV

And now...

This is huge

What tech underpins Responsive Design?

Who proposed Responsive Design?

Ethan Marcotte (@beep)
unstoppablerobotninja.com

www.alistapart.com/articles/responsive-web-design

Who's championing it?

A bunch of sites and developers including:

What can you do with it?

IM AWESOME

Why should I use Responsive Design?

Potential drawbacks and issues?

IM A DUG

How can I avoid problems?

IM A PANDA

What does this have to do with Drupal?

What themes support it?

How Omega makes your site responsive

Omega logo Omega settings

How Adaptive makes your site responsive

Adaptive logo Adaptive settings

Behind Responsive Design

Technology: CSS Media Queries

http://www.w3.org/TR/css3-mediaqueries/

Media Types

media="all/screen/handheld/print/projection/braille/etc."

@media screen { body { color: #111; } }

Feature Detection

<link rel="stylesheet" media="screen and (color)" href="example.css" />

@import url(color.css) screen and (color);

Screen Size

@media all and (min-width:500px) { … }

@media (min-width:500px) { … }

@media (orientation: portrait) { … }

@media all and (orientation: portrait) { … }

Boolean Operators

Feature Detection

print and (monochrome)

tv and (scan: progressive)

aural and (device-aspect-ratio: 16/9)

speech and (min-device-width: 800px)

Feature Detection

only screen and (-webkit-min-device-pixel-ratio: 2)

Drupal and CSS Media Queries

stylesheets[screen and (orientation:landscape)][] = screen-landscape.css

drupal_add_css('my-stylesheet.css', array( 'media' => 'screen and (max-width: 800px)', ));

http://millwoodonline.co.uk/media-queries-drupal

Cascading with Media Queries

stylesheets[all][] = css/global.css
stylesheets[all and (min-width: 800px)][] = lib/TinyFluidGrid/grid.css
stylesheets[all and (min-width: 800px)][] = css/800.css
stylesheets[all and (min-width: 1200px)][] = css/1200.css
stylesheets[all and (min-width: 1600px)][] = css/1600.css

http://millwoodonline.co.uk/media-queries-drupal

Technology: Fluid Grids

http://www.alistapart.com/articles/fluidgrids/

Why Fluid Grids work

Some Fluid Grids systems

Drupal themes that support Fluid Grids

Technology: Flexible Images

http://unstoppablerobotninja.com/entry/fluid-images/

The server can help

How Drupal can help

Ideology: Progressive Enhancement

http://alistapart.com/articles/understandingprogressiveenhancement
http://hesketh.com/thought-leadership/our-publications/inclusive-web-design-future

Revisiting the Browser Wars

This site is optimised for:

Netscape Navigator logo Internet Explorer logo :frogout:

Graceful Degredation

Principles of Progressive Enhancement

Why Responsive Design needs it

The philosophy of Progressive Enhancement underpins Responsive Design

Start with a content layer that works on all devices
And add style behaviour layers to give the best experience on modern browsers

Start with a design that works well for all devices
And make it responsive to give the best experience on modern browsers

Drupal and Progressive Enhancement

Drupal is built with progressive enhancement in mind

Example

Plain Response: a simple responsive theme for Drupal 7

https://github.com/rtrvrtg/Plain-Response

Demo at
http://respond.blackicemedia.com

Example: Theming and templating

Remember that templates themselves are the base level:
We enhance them later

Start by making them semantically rich
Your style and behaviour layers can do the heavy lifting

Example: Markup

Example: Responsiveness

Now let's have it respond to browser size changes

Example: Special behaviour for special sizes

In the case of this site, and mobile devices...
It's more appropriate to move the navigation

People want the content first

Example: Responsive Media

This theme does flexible images a little differently

  • quarter
  • third
  • half
  • twothirds
  • threequarters
  • full
<img originalsrc="public://field/image/JBiUP.jpg" class="third" src="...">

JavaScript builds links to styled files and replaces original images with them
Mobile-first: smallest image rendered by default

There's no one way to do this

WE ARE RESPONSIVE

What resources are available?

Books

(Some) Websites

More resources

(Some) Articles

(Some) People

More resources

Drupal-specific

Other references

Questions?

These slides are now up at
http://blackicemedia.com/presentations/jan2012-responsive

Plain Response up at
http://github.com/rtrvrtg/Plain-Response

Demo at
http://respond.blackicemedia.com

Send questions to
g.roberts@blackicemedia.com
geoffrey@crossfunctional.net
@retrovertigo

Thanks and shoutouts