1
Responsive Web Design – What & How
Manjunatha A Hosur
Responsive Web Design What & How Manjunatha A Hosur 1 - - PowerPoint PPT Presentation
Responsive Web Design What & How Manjunatha A Hosur 1 Introduction What Layouts Media Queries Agenda Responsive Media Considerations Pros & Cons Useful resources Q&A Responsive Web Design 2
1
Responsive Web Design – What & How
Manjunatha A Hosur
2
Responsive Web Design
3
mobile-cellular subscriptions, global penetration reaches 87%, and 79% in the developing world.
subscriptions have grown 45% annually
years and today there are twice as many mobile- broadband as fixed broadband subscriptions.
4
17% of cell phone owners do most of their online browsing on their phone, rather than a computer or other device
5
Mobile users greater than desktop in near future Source: Morgan Stanley Internet Trends Mobile users greater than desktop in near future
6
Users are always in control Web designers v/s Web users – Who is in control
Designers
width
create identical experiences cross- browser & cross-platform
Users
to use
increase and reduce font size
it at half available width
how, they access our content
7
So many devices
8 8
Screen sizes
800x480 854x480 482x320 1024x768 1024x600 960x640 1920x1080 Samsung Galaxy S Vibrant Nexus One HTC Incredible HTC EVO HTC Desire HD Windows Phone 7 Droid Droid 2 Droid X iPhone 3GS & lower iPhone 4 iPad PC Galaxy Tab Blackberry Playbook PC TV
9 9
Input devices
10 10
Summarize the issues Users are in control
Display size Hundreds of devices now, thousands more to come Network speeds Standards support Input method Context
11 11
Is Separate sites the solution?
Creating separate sites for specific kinds of devices
support
No hope of convergence Building separate sites is not future friendly. Adapting to flexible web is the only way
12 12
Responsive Design Approach
Small + Medium + Large One site for every screen.
13
Fluid Layouts Converting fixed units to flexible units
Target / Context = Result
Sizing of fonts
Grid Layouts
structure
CSS tables
display:table- cell;
14
Media Queries - Introduction Media queries define which styles should apply under specific circumstances by allowing you to query the values of features such as resolution, colour depth, height, and width. By carefully applying media queries, you can iron out the remaining wrinkles in fluid layout.
15
The viewport meta tag lets us control the scaling and layout viewport of many devices.
<meta name="viewport" content="directive,directive" />
Meta Tag
<meta name="viewport" content="width=device-width" />
Width
<meta name="viewport" content="width=device-height" />
Height
<meta name="viewport" content="user-scalable=no" />
User-Scalable
<meta name="viewport" content="initial-scale=1, width=device-width />
Initial-Scale
Viewport tags and properties
Maximum-Scale / Minimum-Scale
@viewport { width: device-width; }
CSS Device adaption
Currently Limited to prefix – Opera & IE 10
16
Media query
Let you question the browser to determine if certain expressions are true. If they are, you can load a specific block of styles intended for that situation and tailor the display.
@media [not|only] type [and] (expr) { rules } Basic components
17
Media Types
Source : http://www.w3.org/TR/CSS2/media.html
18
Media Types - Components
Media Expressions
Tells user agent to whether or not to load a particular stylesheet for a given type of media. Syntax : @media print { }
<link rel="stylesheet" href="print.css" media="print" />
Most devices support screen instead of specific devices. Ability to test against different features of a device using expressions that evaluate to either true or false. Syntax : @media screen and (min-width: 320px) { } Width Device-Height device-aspect-ratio monochrome Height Orientation Color Resolution Device-Width aspect-ratio Color-Index Grid
19
Media Types - Components
Rules
queries more powerful.
@media not screen and (color) {...}
load a set of styles if any one of a series of specified expressions evaluates to true: @media print and (color), tv and (color)
recognize it. @media only screen and (color)
These are basic CSS style rules that included within media query. @media only screen and (min-width: 320px) { a{ color: red; } }
20
Using media queries
Placed in media attribute of link element to include an external stylesheet.
<link href="style.css" media="only screen and (min-width: 960px)" />
a{ text-decoration:none; } @media screen and (min-width: 960px) { a{ text-decoration: underline; } }
Media queries could be used in two ways
21
Media query order
/* base styles */ @media all and (max-width: 768px) { ...} @media all and (max-width: 320px) {….}
The default layout is what you typically see on the screen of a browser on a laptop or desktop computer. Then, using a series of media queries (typically max-width), the layout is simplified and adjusted for smaller screens Using media queries to adjust the layout for mobile experience first. /* base styles */ @media all and (max-width: 320px) {….} @media all and (max-width: 768px) {…}
22
Responsive Navigation
Responsive Navigation
Designing proper site navigation is key to responsive design.
Good responsive navigation adheres to following criteria
estate
intuitive
devices Following are some of popular techniques for handling navigation in responsive designs
Navigation needs to be accessible and easy to use, no matter the screen size. Example, www.indochino.com
Source:
http://bradfrostweb. com/blog/web/resp
23
Responsive Media 71% of mobile phone Users
expect mobile phone users to load as quickly on their mobile phones as their desktops.
Increasing page load time increases performance. 74% of mobile phone Users
will only wait 5 seconds or less for a page to load.
57% of mobile web users
who were disappointed will not recommend the site.
are unlikely to return to a slow loading site.
Main reason for degraded performance of mobile sites is due to large media assets being downloaded like images and video.
Source: Equation Research on behalf of Compuware
24
Solution to performance issues
matchMedia() javascript
Better handling of background images. Handling devices with Retina display using –webkit-min-device-pixel-ratio
Responsive Image options Selectively serving images to mobile if (window.matchMedia("(min
{ ….. } Sencha.io Adaptive Images http://src.sencha.io /768/http://www.d
ages/product1.jpg Cloudinary
25
Time & Money Support
Performance
Content Mobile Ads
26
Pros & Cons
technology, it’s a powerful development philosophy.
different device specific sites is costly and drags the innovation.
development intended to support
single front end codebase.
Sketching / Wireframing
tools
6
Responsive design elements
Templates and Grids
js scripts
Mediaqueries JS
Testing tools
debugger
28
&