Responsive Web Design Josh Hughes hughesjd@missouri.edu What is - - PowerPoint PPT Presentation

responsive web design
SMART_READER_LITE
LIVE PREVIEW

Responsive Web Design Josh Hughes hughesjd@missouri.edu What is - - PowerPoint PPT Presentation

Responsive Web Design Josh Hughes hughesjd@missouri.edu What is Responsive Design? A quick overview Fluid Grid Fluid Grid Page - 960 px Menu Content Area 215 px 685 px Inset Sidebar 215 px 20 px 20 px left and left margin right margins


slide-1
SLIDE 1

Responsive Web Design

Josh Hughes hughesjd@missouri.edu

slide-2
SLIDE 2

What is Responsive Design?

A quick overview

slide-3
SLIDE 3

Fluid Grid

slide-4
SLIDE 4

Fluid Grid

Menu 215 px 20 px left margin Content Area 685 px 20 px left and right margins Inset Sidebar 215 px 20 px left and right margins Page - 960 px

slide-5
SLIDE 5

Fluid Grid

target ÷ context × 100 = percentage

slide-6
SLIDE 6

Fluid Grid

Menu: 215/960 × 100 = 22.3958333333% Content Area: 685/960 × 100 = 71.3541666667% Inset Sidebar: 215/685 × 100 = 31.3868613139%

slide-7
SLIDE 7

Fluid Grid

20px margin for the Menu and Content Area: 20/960 × 100 = 2.0833333333% 20px margin for the Inset Sidebar: 20/685 × 100 = 2.9197080292%

slide-8
SLIDE 8

Fluid Grid

Menu 22.39583 33333% (215/960) 2.083333 3333% (20/960) left margin Content Area 71.3541666667% (685/960) 2.0833333333% (20/960) left and right margins Inset Sidebar 31.386861 3139% (215/685) 2.919708 0292% (20/685) left and right margins Page - 90% (Up to you)

slide-9
SLIDE 9

Viewport Fix

<meta ¡ ¡name="viewport" ¡ ¡content="width=device-­‑width, ¡ ¡ ¡ ¡ ¡initial-­‑scale=1.0" > ¡

slide-10
SLIDE 10

Viewport Fix

Without Meta Tag With Meta Tag

slide-11
SLIDE 11

Flexible Images

slide-12
SLIDE 12

Flexible Images

  • 1. Set max-­‑width: ¡100% on the img
  • 2. Do not set width or height on the img in the HTML
  • r

Set width: ¡auto and height: ¡auto in the CSS

slide-13
SLIDE 13

Flexible Video

Similar situation as images, but maintaining proper proportions is a problem. Easiest solution is to use Fitvids.

slide-14
SLIDE 14

Media Queries

slide-15
SLIDE 15

Media Queries

body ¡ { ¡ background: ¡red; } @media ¡screen ¡and ¡(min-­‑width: ¡600px) { ¡ body ¡{ ¡background: ¡green; ¡} }

slide-16
SLIDE 16

Common Media Query Conditions

min-­‑width or min-­‑height Applied if the window is equal to or greater than this value max-­‑width or max-­‑height Applied if the window is equal to or less than this value

slide-17
SLIDE 17

Common Media Query Conditions

min-­‑device-­‑width or min-­‑device-­‑height Applied if the device screen is equal to or greater than this value max-­‑device-­‑width or max-­‑device-­‑height Applied if the device screen is equal to or less than this value

slide-18
SLIDE 18

Example Sites

slide-19
SLIDE 19

Browser Support

Short version: Pretty much everything except Internet Explorer 8 and below

slide-20
SLIDE 20

Browser Support

Long version: Internet Explorer: 9.0+ Firefox: 3.5+ Chrome: 4.0+ Safari: 3.1+ (a bit buggy until 4.0, however) Opera: 9.5+ iOS: 3.2+ Android: 2.1+ Windows Phone: 7.5+ (Mango) Blackberry: 4.7.1+

slide-21
SLIDE 21

“Fixing” Internet Explorer

There are Javascript options for filling the hole. respond.js is the one I would recommend.

slide-22
SLIDE 22

Responsive Web Design versus Other Options

slide-23
SLIDE 23

Native Apps

slide-24
SLIDE 24

Native Apps

Pros

  • Can provide a slick user experience
  • Can more easily access device features

(camera, GPS, etc.)

  • Available for offline use
slide-25
SLIDE 25

Native Apps

Cons

  • Very expensive
  • Hard to do well
  • Which platforms do you support?
  • Your users (probably) don't want a native app
  • You still need a website
slide-26
SLIDE 26

Mobile-Specific Websites

slide-27
SLIDE 27

Mobile-Specific Websites

Pros

  • Easier to optimize for speed
  • More freedom to create a unique

mobile experience

  • Can more easily target less advanced devices,

like feature phones

slide-28
SLIDE 28

Mobile-Specific Websites

Cons

  • Have to deal intelligently with redirects
  • Ignores tablets for the most part
  • Tends to offer an incomplete experience
slide-29
SLIDE 29

Responsive Web Design

slide-30
SLIDE 30

Responsive Web Design

Pros

  • Only have to maintain a single website
  • Don't need to deal with mobile-specific URLs
  • Addresses a wide multitude of devices:

phones, tablets, desktops, etc.

slide-31
SLIDE 31

Responsive Web Design

Cons

  • More difficult to optimize properly for

specific devices (for example, phones might get desktop-sized images)

slide-32
SLIDE 32

Things to Keep in Mind as You Get Started

slide-33
SLIDE 33

Set breakpoints wherever you need them

Make your choices based on the design rather than the device

slide-34
SLIDE 34

Don’t assume that “mobile” users want less content

slide-35
SLIDE 35

Mobile First

slide-36
SLIDE 36

Mobile First

  • Start your design process with mobile
slide-37
SLIDE 37

Mobile First

  • Start your design process with mobile
  • Make the mobile view the default
slide-38
SLIDE 38

Dealing with Images

slide-39
SLIDE 39

CSS Background Images

Pros

  • Easy to setup
  • Least likely option to result in both images

getting downloaded Cons

  • Content editors probably aren’t going to be able to

use this method

  • With some caveats, they don’t resize
slide-40
SLIDE 40

CSS Background Images

Example:

<div ¡class="replace">Alternate ¡Text</div> .replace { ¡ ¡ ¡ ¡text-­‑indent: ¡100%; ¡ ¡ ¡ ¡white-­‑space: ¡nowrap; ¡ ¡ ¡ ¡overflow: ¡hidden; ¡ ¡ ¡ ¡background: ¡url(images/replace.png) ¡no-­‑repeat; ¡ ¡ ¡ ¡width: ¡600px; ¡ ¡ ¡ ¡height: ¡200px; }

slide-41
SLIDE 41

CSS Background Images

Example:

.replace { ¡ ¡ ¡ ¡text-­‑indent: ¡100%; ¡ ¡ ¡ ¡white-­‑space: ¡nowrap; ¡ ¡ ¡ ¡overflow: ¡hidden; ¡ ¡ ¡ ¡background: ¡url(images/replace.png) ¡no-­‑repeat; ¡ ¡ ¡ ¡width: ¡600px; ¡ ¡ ¡ ¡height: ¡200px; } @media ¡screen ¡and ¡(min-­‑width: ¡600px) { ¡ ¡ ¡ ¡.replace ¡{ ¡background-­‑image: ¡url(images/new.png); ¡} }

slide-42
SLIDE 42

Inline Images

Pros

  • Easy for content editors to add
  • Scaling is easy

Cons

  • Difficult to do any kind of swapping
  • Very likely that the user will end up downloading

both images

slide-43
SLIDE 43

The Double-Download Problem

slide-44
SLIDE 44

Navigation Design Patterns

slide-45
SLIDE 45

Dropdown Menu

slide-46
SLIDE 46

Select Menu

slide-47
SLIDE 47

Just Stack ‘em

slide-48
SLIDE 48

Footer Menu

slide-49
SLIDE 49

Off-Canvas Flyout

slide-50
SLIDE 50

Responsive Design

Most things come down to the following options:

  • Drop the content down
  • Make the content viewable via a toggle
  • Hide the content altogether (use sparingly)

You can also use Javascript if you need to rearrange the HTML to fit a design.

slide-51
SLIDE 51

Thanks!

Questions? Comments? Josh Hughes hughesjd@missouri.edu