responsive design

60
RESPONSIVE DESIGN @doxaras @niobiumlabs

Upload: yiannis-doxaras

Post on 27-Jan-2015

5.011 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Responsive design

RESPONSIVE DESIGN @doxaras

@niobiumlabs

Page 2: Responsive design

RESPONSIVE WEB DESIGN

Page 3: Responsive design

THE NEED

Page 4: Responsive design

APPLE IS EVIL

Page 5: Responsive design

HTML5 APPS

Page 6: Responsive design

SCREEN FRAGMENTATION

http://sender11.typepad.com/sender11/2008/04/mobile-screen-s.html

Page 7: Responsive design

JSFIDDLE DEMOhttp://jsfiddle.net/doxaras/nCGUu/

Page 9: Responsive design

BROWSER GRADING

“Any device that doesn’t support media queries will receive the basic C-grade experience

Page 10: Responsive design

AN OLD STORY REVIVING

http://www.alistapart.com/d/responsive-web-design/ex/ex-site-flexible.html

Page 11: Responsive design
Page 12: Responsive design

LETS GET THING FROM THE BEGINNING

Page 13: Responsive design

fluid elastic fixed

Page 14: Responsive design

VIEWPORTS<meta name=”viewport” content=”width:device-width”>

always use it for mobile and fluid designs

Page 15: Responsive design

MEDIA QUERIES

<link rel="stylesheet" type="text/css" href="core.css" media="screen" /><link rel="stylesheet" type="text/css" href="print.css" media="print" />

CSS 2.1

<link rel="stylesheet" type="text/css" media="screen and (max-device-width: 480px)" href="shetland.css" />

CSS3

Page 16: Responsive design

WAIT THERE IS MORE!!

<link rel="stylesheet" type="text/css" media="screen and (max-device-width: 480px) and (resolution: 163dpi)" href="shetland.css" />

@media screen and (max-device-width: 480px) { .column { float: none; }}

@import url("shetland.css") screen and (max-device-width: 480px);

Page 17: Responsive design

AND MORE

@media only screen and (min-device-width : 320px) (max-device-width : 569px) {...}

Page 18: Responsive design

AND MORE@media only screen and (min-width : 480px) { .box { width:200px; height:200px; background:yellow; } }@media only screen and (max-width : 320px) { .box {width:200px; height:200px; background:red; } }

Page 19: Responsive design

DEVICE-WIDTH

Question:Is max/min-width the same as max/min-device-width?

Answer:If you set width=device-width, then max/min-width is the same as max/min-device-width in portrait mode, and different when in landscape mode. In short, the difference is max/min-width will update when you rotate the screen, whereas, max/min-device-width won't.

Page 20: Responsive design

DEVICE-PIXEL

device-pixel-ratio could help you know the resolution of the device screen, iPhone 4 and certain other smartphones have pixel ration equal or higher than 1.5, so if you want to target high resolution devices, you can use the media query below:

@media only screen and (-webkit-min-device-pixel-ratio : 1.5),

only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (min-device-pixel-ratio : 1.5) { .imagebox {background:(url:"images/high/demo.jpg");}

}

image will be downloaded even if the page doesn't fit the rule above!!

Page 21: Responsive design

ORIENTATION

iPad introduced 'orientation' to help with detecting orientation change, below is how you can specify landscape and portrait style

/* iPads (landscape) ----------- */@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) { /* Styles */}

/* iPads (portrait) ----------- */@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) { /* Styles */}

Page 22: Responsive design

OK I G

OT IT

Page 23: Responsive design

USE TH

E FO

RCE

Page 24: Responsive design

JSFIDDLE DEMOhttp://jsfiddle.net/doxaras/LeB47/

Page 25: Responsive design

TYPOGRAPHY

Page 26: Responsive design
Page 27: Responsive design

62.5% RULE (EM2PX)

•modern browsers have a 16px font default size*

•body{font-size:62.5%}

•16x62.5=10px

•p{font-size:1.3em;}

add html{font-size:16px; } just to be sure

Page 28: Responsive design

IMAGES

Page 29: Responsive design

SIZING

.figure { float: right; margin-bottom: 0.5em; margin-left: 2.53164557%; /* 12px / 474px */ width: 48.7341772%; /* 231px / 474px */}

img { max-width: 100%;}

http://www.alistapart.com/articles/fluid-images/

Page 30: Responsive design

SIZING

<img src="smallRes.jpg" data-fullsrc="largeRes.jpg">

img { max-width: 100%; }

Page 31: Responsive design

JSFIDDLE DEMOhttp://jsfiddle.net/doxaras/T66wQ/

Page 32: Responsive design

DESIGN PATTERNS

Page 33: Responsive design

COLUMN MERGING

Page 34: Responsive design

DEALING WITH TABLES

http://css-tricks.com/examples/ResponsiveTables/responsive.php

Page 38: Responsive design

JSFIDDLE DEMOhttp://jsfiddle.net/doxaras/CKPnJ/

Page 39: Responsive design

THE TOOLS

Page 40: Responsive design

WEB DEVELOPER

Page 41: Responsive design
Page 42: Responsive design

PIXEL 2 EM

Page 43: Responsive design

APART.JS

Page 44: Responsive design

LETTERING.JS

Page 45: Responsive design

FITTEXT.JS

Page 46: Responsive design
Page 47: Responsive design

FLUID 960

Page 48: Responsive design

MODERNIZR

Page 49: Responsive design

RESPOND.JS

•really small script < 1kb

•enabling old browsers IE7 IE8

•responsive is not just a mobile problem

•backwords compatibility of your designs

Page 50: Responsive design

LESS FRAMEWORK

Page 51: Responsive design

TIPS & TRICKS

Page 52: Responsive design

APPLE VIEWPORT

<meta name="viewport" content="width=device-width; initial-scale=1.0">

Page 53: Responsive design

SELECTORS SHOULD BE PRESENT ALSO IN THE PLAIN CSS DOCUMENTS

Page 54: Responsive design

EM’S AND PX’S

• local DOM scope overrides the default 62.5% rule

• left and right

• top and line-height should be em’s

• avoid nested em definitions

Page 55: Responsive design

TRANSITIONS

body { transition:all .2s linear; -o-transition:all .2s linear; -moz-transition:all .2s linear; -webkit-transition:all .2s linear; }

Page 56: Responsive design

RETINA DISPLAY SELECTORS

<link rel="stylesheet" media="only screen and (-webkit-min-device-pixel-ratio: 2)" type="text/css" href="../iphone4.css" />

Page 57: Responsive design

HIDE NAVIGATION

// When ready...window.addEventListener("load",function() { // Set a timeout... setTimeout(function(){ // Hide the address bar! window.scrollTo(0, 1); }, 0);});

Page 58: Responsive design

META TAG FOR NAME

<meta name="apple-mobile-web-app-capable" content="yes" />

Page 59: Responsive design

KNOW THY DIMENSIONS

Page 60: Responsive design

THAT’S ALL FOLKSDROP ME AN EMAIL AT

[email protected]