Cross-Device Development
with Web Standards
Tomomi Imura
flickr.com/photos/64855052@N00/3967578543/ by Yoichi Nakanishi b
H E L L O
M Y N A M E I S
Tomomi
@girlie_mac
02
One Web Approach
Mobile Web Best Practices by W3C (2008)
One Web means making, as far as is
reasonable, the same information
and services available to users
irrespective of the device they are
using. ”
“
Mobile Web Best Practices 1.0 (2008)
03
Form Factors · Screen Sizes
[SF HTML5] Responsive Cross-Device Development with Web Standards (2013)
[SF HTML5] Responsive Cross-Device Development with Web Standards (2013)
Adaptive Design
07
Adaptive Design
1. Progressive Enhancement
• Enhancing Experiences based on browser
capabilities
• Graceful Degradation - Fallbacks
2. Responsive Design
• Fluid Layout
• Media Queries
• Responsive Images08
Fluid Layout
Neue
flickr.com/photos/meantux/378103724/ by Denis-Carl Robidoux bn
Then
• HTML Table Layout (Party like it's 1999)
• The CSS "Holy Grail" Column Liquid Layout
• Float
• Negative margin
• All the hacks that are PITA
• UI Frameworks for Grid Layout
• YUI
• jQuery Masonry10
Now and Future: CSS3 Layouts
• Columns
• Flexible Box ("FlexBox")
• Regions
• Grids
11
Fluid Columns
Demo on JSFiddle
12
CSS Multi-column Layout Module
.col{
-webkit-columns:200px;
-moz-columns:200px;
columns:200px;
/*column-count:auto*/
}
Browser Support:
* 2.1* 3* 7* * 10 11.5p 15Bl*
http://www.w3.org/TR/css3-multicol/
13
Flexbox Layout with MQ
Demo on JSFiddle
14
CSS Flexible Box Layout Module
#main{
display:flex;
flex-flow:row;
}...
@mediaalland(max-width:640px){
#main{
flex-flow:column;
}
}
Latest syntax:
21* 7* 10* 11 12p 15Bl
http://www.w3.org/TR/css3-flexbox/
15
Responsive Regions Layout
Demo on Codepen: http://cdpn.io/LbAFq
16
CSS Regions Module
A
1
2
3
4
http://dev.w3.org/csswg/css-regions/
17
Responsive Regions Layout
<divclass="regionregion1"></div>
<divclass="regionregion2"></div> ...
<articleclass="content">contenthere...</article>
.content{flow-into:article;}
.region{flow-from:article;}
@mediascreenand(max-width:400px){
.content{flow-into:none;}
.region{display:none;}
}
7* 10*
IE10 requires iframe18
Responsive Grid
An arrangement suitable for ‘portrait’ orientation. An arrangement suitable for ‘landscape’ orientation.
10*
http://www.w3.org/TR/css3-grid-layout/
19
Media-Queries
http://commons.wikimedia.org/wiki/File:Metric_Volume_Measuring_Vessels_Frontsides-In_use.jpg ba
CSS2.1 @media Media-Types
For mobile phones:
@mediahandheld{
/*Somemobile-specificCSShere*/
}
Only supported by:
• Opera Mini
• OpenWave
• Obigo
• PIE (partial)21
CSS3: Media-Queries
allows content rendering to adapt to conditions:
• width of the target viewport
• width of the device's screen size
• screen orientations (landscape v. portrait)
• device pixel ratio (aka. Retina)
etc...
22
CSS3: Media-Queries
Separate styles by the width of the target viewport (browser display
area)
@mediaonlyscreen
and(min-width:768px)
and(max-width:1024px){
/*Styles*/
}
23
CSS3: Media-Queries
by device-width, the width of the device's screen size
@mediaonlyscreen
and(min-device-width:320px)
and(max-device-width:480px){
/*Styles*/
}
24
CSS3: Media-Queries
combined with screen orientations
@mediaonlyscreen
and(min-device-width:768px)
and(max-device-width:1024px)
and(orientation:landscape){
/*Styles*/
}...
25
CSS3: Media-Queries
CSS3, Hell Yeah!
@mediaonlyscreen
and(max-width:calc(768px-2em)){
/*Styles*/
}...
26
CSS3: Media-Queries
separate styles by device pixel ratio
27
High Pixel Density
Displays
The High DPI
https://www.webkit.org/blog/55/high-dpi-web-sites/
29
30
31
32
33
34
CSS Pixel vs. Device Pixel
• Pixel in CSS is relative
• 1 CSS pixel != 1 device pixel
35
Pixel Density in DOM
window.devicePixelRatio
Device Browser Pixel Density
Nexus One Android browser 1.5
Galaxy Nexus Chrome 2.0
Galaxy Nexus Opera Mobile 2.25
Samsung Galaxy S4 Chrome 3.0
36
Zoom Dependent Pixel Density
⌘+ and ⌘- , but not for pinch-zoom
Test page (Firefox and Chrome 31+)
37
Media-Queries for "Retina"
@mediaonlyscreenand(min-device-pixel-ratio:2){
/*stylesforhi-DPIscreens*/
}
38
WTF Vendor Prefix!
@mediaonlyscreenand(-webkit-min-device-pixel-ratio:1.5){...}
@mediaonlyscreenand(min--moz-device-pixel-ratio:1.5){...}
@mediaonlyscreenand(-o-min-device-pixel-ratio:3/2){...}39
Unprefix: resolution MQ
@media(-webkit-min-device-pixel-ratio:2),
(min-resolution:192dpi){
...
}
Typical Browser: 96dpi (96 CSS-pixel in 1 CSS-inch)
40
...even easier
@media(-webkit-min-device-pixel-ratio:2),
(min-resolution:2dppx){
...
}
29 16
41
CSSOM View Module:
matchMedia()
approaching media-queries in DOM
varmql=window.matchMedia(mediaQueryString);
Browser Support:
9 3 5 10 6 10 12.1p 15Bl
http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface
42
varmql=window.matchMedia('(orientation:landscape)');
if(mql.matches){
/*thecurrentorientationisinlandscape*/
}else{
/*portrait*/
}
43
CSS Device Adaptation
<metaname="viewport"content="width=device-width">
↓CSS
@viewport{
width:device-width;
}
44
CSS Device Adaptation
@-o-viewport{width:device-width}
@-ms-viewport{width:device-width}*
@viewport{width:device-width}
11P 10
* bug in IE10 - reports in device pixel value
45
@viewport in @media
@mediascreenand(orientation:portrait){
@viewport{
width:768px;
height:1024px;
}
/*CSSforportraitlayoutgoeshere*/
}
46
Media Queries Level 4
• "pointer" - accuracy of a pointing device.
• none
• coarse aka "fat finger"
• fine
• "hover"
• 0
• 1
http://dev.w3.org/csswg/mediaqueries4/#pointer
47
Media Queries Level 4
@media(hover){
.menuli:hover{
background-color:#bada55;
}
}
48
MQ L4: Range Features
@media(min-height:600px){...}
↓
@media(height>= 600px){...}
http://dev.w3.org/csswg/mediaqueries/#mq-range-context
49
MQ L4: Luminosity
@media(luminosity:normal){
body{background-color:#ddd;color:#000;}
}
@media(luminosity:dim){
body{background-color:#444;color:#fff;}
}
@media(luminosity:washed){
body{background-color:#fff;color:#333;}
}
http://dev.w3.org/csswg/mediaqueries4/#luminosity
50
DOM Ambient Light Events Demo
Video Link: https://vimeo.com/79466285 • Codepen Demo: http://cdpn.io/pvmBs
0:22
51
Responsive Images
flickr.com/photos/joaomoura/2348271655/ bna
Responsive Images Use Cases
1. Resolution switching
2. Art Direction
3. DPR Switching (High-Res images)
53
Resolution switching
54
Art-Direction
instead of simple scaling
55
DPR Switching: High-Res Images
1x
2x56
Currently used methods
and problems
57
Using Media-Queries
@mediaonlyscreen
and(min-device-width:768px)
and(max-device-width:1024px){
background-image:url(cat-tablet.jpg);
width:640px;height:320px;
}
@mediaonlyscreenand(min-width:1224px){
background-image:url(cat-desktop.jpg);
...
}
58
Yay
• Easy enough. No scripts.
Meh
• Hard to figure out MQ Breakpoint
• Not semantic to use background for contents
• Some browsers download all assets (Tests by Tim
Kadlec)
59
Fluid Resizing an Image
60
Fluid Resizing an Image
Shrink and Stretch without MQ
<imgsrc="images/relatively-large-photo.jpg"alt="cat">
img{
width:100%;
height:auto;
}
61
Yay
• Only one asset
• Easy to implement. No MQ breakpoints needed.
Meh
• CPU intensive
• Westing bandwidth
62
Art Direction: Cropping with CSS
https://dl.dropboxusercontent.com/u/1330446/tests/clip.html
63
CSS2 Clip Property
<divclass="image-container">
<imgsrc="images/sushi-large.jpg"></div>
.image-container{position:relative;}
.image-containerimg{position:absolute;}
@mediaonlyscreenand(max-width:480px){
.image-containerimg{
clip:rect(80px270px270px240px);//BLEH!!!
}
}64
CSS2 Clip Property
position:absolute;
clip:rect(toprightbottomleft);
Photo: http://www.flickr.com/photos/nicolelee/1798352472/ by Nicole Lee bna
65
Yay
• Only one asset
Meh
• CSS clip is cumbersome
• Westing bandwidth
66
Up-Res for Hi-DPI Screens
67
Up-Res Images with MQ
.banner{
background-image:url(banner.png);
width:320px;height:160px;
}
@media(-webkit-min-device-pixel-ratio:2),
(min-resolution:2dppx){
.banner{
background-image:url(banner-2x.png);
background-size:100%;
}
}
68
Yay
• Simple enough to implement
Meh
• Browser-dependent MQ data types / prefix
• Not semantic to use background for contents
• Some browsers download all assets (Tests by Tim
Kadlec)
69
Up-Res with CSS image-set()
<divid="photo01"></div>
#photo01{
width:300px;height:200px;
background-image:url(images/lowres.jpg);
background-image:
-webkit-image-set(url(images/lowres.jpg)1x,
url(images/hires.jpg)2x);
}
6* 19* 15bl*
CSS Image Values and Replaced Content Module Level 4
70
Yay
• Less hassle syntax
Meh
• Not enough browser supports. Spec is unstable.
• Not semantic to use background for contents
71
Vector Graphics FTW!
72
SVG
<imgsrc="logo.svg"width="432 ">
73
Web Font Icons
36px 72px 108px
144px 288px
  
  IcoMoon
74
Web Font Icons
<spandata-icon="&#xe000;">forkme</span>
@font-face{
font-family:'icons';
src:url('fonts/icons.woff')format('woff');
}
[data-icon]::before{
font-family:'icons';
content:attr(data-icon);
font-size:72px;
}
75
Other Solutions
• Javascript
• Mobify.js etc.
• Polyfills (Picturefill.js, x-picture/Polymer)
• Server-side
• "Adaptive Images" (PHP)
• Sencha.io Src (UA lookup in Cloud)
• Creative Hacks
• Clown Car Technique76
Responsive <img>?
77
O NOES! <img> was not made for the
responsive design!
78
We need a standard solution.
... or a few.
79
The srcset attribute
Proposal by Apple & adopted by WhatWG
<imgalt="TheBreakfastCombo"
src="banner.jpeg"
srcset="banner-HD.jpeg2x,
banner-phone.jpeg100w,
banner-phone-HD.jpeg100w2x">
WebKit Nightly r154002
The srcset attribute - An HTML extension for adaptive images
80
Picture Element
Proposal RespImg CG
<picturewidth="500"height="500">
<sourcemedia="(min-width:45em)"src="large.jpg">
<sourcemedia="(min-width:18em)"src="med.jpg">
<sourcesrc="small.jpg">
<imgsrc="fallback.jpg">
<p>Accessibletext</p>
</picture>
Responsive Images Community Group
81
HTTP Client-Hints
Proposal from Google: let the server selects the right asset
[Request]
GET/kitten.jpgHTTP/1.1
User-Agent:...
Accept:image/webp,image/jpg
CH:dpr=2.0
http://www.igvita.com/2013/08/29/automating-dpr-switching-with-client-hints/
82
What's
Next?
http://www.flickr.com/photos/barbostick/3581760713/ ba
Smart TV
W3C: Web and TV Interest Group
Panasonic Viera Smart TV
84
Automotive
proposals for standardizing HTML5-based
vehicle APIs:
• Tizen
• Webinos
• GENIVI
• QNX
W3C: Automotive and Web Platform Business Group
QNX Auto Blog
85
Wearable Devices & IoT
http://imgur.com/g/memes/qKH2tM8
86
Thank you!
Tomomi Imura
• @girlie_mac
• girliemac.com
• github.com/girliemac
• speakerdeck.com/girlie_mac
Slide: http://girliemac.github.io/presentation-slides/html5-mobile-
approach/rwd.html87
88

More Related Content

PDF
Devon 2011-f-1 반응형 웹 디자인
PDF
CSS3: Simply Responsive
PDF
CSS3: Ripe and Ready to Respond
PDF
(Practical) Beyond Responsive Web Design (WordCamp Miami 2011)
PDF
смартфоны и планшетники. веб разработка помимо десктопа. Patrick h. lauke. зал 1
PPT
Responsive Web Design
PDF
CSS3: Using media queries to improve the web site experience
PDF
Great Responsive-ability Web Design
Devon 2011-f-1 반응형 웹 디자인
CSS3: Simply Responsive
CSS3: Ripe and Ready to Respond
(Practical) Beyond Responsive Web Design (WordCamp Miami 2011)
смартфоны и планшетники. веб разработка помимо десктопа. Patrick h. lauke. зал 1
Responsive Web Design
CSS3: Using media queries to improve the web site experience
Great Responsive-ability Web Design

Similar to [SF HTML5] Responsive Cross-Device Development with Web Standards (2013) (20)

PDF
Responsive Web Design, get the best out of your designs - JavaScript Open Day...
PDF
PDF
Responsive Websites
PDF
Responsive websites. Toolbox
PDF
Responsive Web Site Design
PDF
The specs behind the sex, mobile-friendly layout beyond the desktop
PDF
Introduction to CSS3
PDF
Building Better Responsive Websites
PDF
Responsive web design
PDF
Responsive web - CC FE & UX
PPTX
CSS3 Media Queries And Creating Adaptive Layouts
PDF
Cross Device UI Designing
PPTX
FITC - 2012-04-23 - Responsive Web Design
PPTX
Responsive & Adaptive Web Design
PDF
Responsive webdesign WordCampNL 2012
PPTX
Responsive web design
PDF
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...
PDF
Смартфоны и планшетники - mobile-friendly веб-разработка помимо десктопа - RI...
PPTX
Approaches to Responsive Wen Design & Development
PDF
Responsible Web Design
Responsive Web Design, get the best out of your designs - JavaScript Open Day...
Responsive Websites
Responsive websites. Toolbox
Responsive Web Site Design
The specs behind the sex, mobile-friendly layout beyond the desktop
Introduction to CSS3
Building Better Responsive Websites
Responsive web design
Responsive web - CC FE & UX
CSS3 Media Queries And Creating Adaptive Layouts
Cross Device UI Designing
FITC - 2012-04-23 - Responsive Web Design
Responsive & Adaptive Web Design
Responsive webdesign WordCampNL 2012
Responsive web design
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...
Смартфоны и планшетники - mobile-friendly веб-разработка помимо десктопа - RI...
Approaches to Responsive Wen Design & Development
Responsible Web Design
Ad

More from Tomomi Imura (20)

PDF
ECMeowScript - What's New in JavaScript Explained with Cats (August 14th, 2020)
PDF
[POST.Dev Japan] VS Code で試みる開発体験の向上
PDF
[Japan M365 Dev UG] Teams Toolkit v4 を使ってみよう!
PDF
[#DevRelAsia Keynote 2020] Developer Centric Design for Better Experience
PDF
Engineering career is not a single ladder! - Alternative pathway to develope...
PDF
Being a Tech Speaker with Global Mindset
PDF
#TinySpec2019 Slack Dev Meetup in Osaka & Tokyo (in Japanese)
PDF
Slack × Twilio - Uniquely Powering Communication
PDF
[2019 Serverless Summit] Building Serverless Slack Chatbot on IBM Cloud Func...
PDF
[2019 south bay meetup] Building more contextual message with Block Kit
PDF
[TechWorldSummit Stockholm 2019] Building Bots for Human with Conversational ...
PDF
Building a Bot with Slack Platform and IBM Watson
PDF
[日本語] Slack Bot Workshop + Intro Block Kit
PDF
[DevRelCon Tokyo 2019] Developer Experience Matters
PDF
[DevRel Summit 2018] Because we all learn things differently
PDF
[DevRelCon July 2018] Because we all learn things differently
PDF
[Japanese] Developing a bot for your workspace 翻訳ボットを作る!
PDF
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
PDF
Future of the Web with Conversational Interface
PDF
[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...
ECMeowScript - What's New in JavaScript Explained with Cats (August 14th, 2020)
[POST.Dev Japan] VS Code で試みる開発体験の向上
[Japan M365 Dev UG] Teams Toolkit v4 を使ってみよう!
[#DevRelAsia Keynote 2020] Developer Centric Design for Better Experience
Engineering career is not a single ladder! - Alternative pathway to develope...
Being a Tech Speaker with Global Mindset
#TinySpec2019 Slack Dev Meetup in Osaka & Tokyo (in Japanese)
Slack × Twilio - Uniquely Powering Communication
[2019 Serverless Summit] Building Serverless Slack Chatbot on IBM Cloud Func...
[2019 south bay meetup] Building more contextual message with Block Kit
[TechWorldSummit Stockholm 2019] Building Bots for Human with Conversational ...
Building a Bot with Slack Platform and IBM Watson
[日本語] Slack Bot Workshop + Intro Block Kit
[DevRelCon Tokyo 2019] Developer Experience Matters
[DevRel Summit 2018] Because we all learn things differently
[DevRelCon July 2018] Because we all learn things differently
[Japanese] Developing a bot for your workspace 翻訳ボットを作る!
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
Future of the Web with Conversational Interface
[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...
Ad

Recently uploaded (20)

PDF
Introduction to MCP and A2A Protocols: Enabling Agent Communication
PDF
The AI Revolution in Customer Service - 2025
PDF
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
PDF
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
PDF
IT-ITes Industry bjjbnkmkhkhknbmhkhmjhjkhj
PDF
giants, standing on the shoulders of - by Daniel Stenberg
PDF
Examining Bias in AI Generated News Content.pdf
PDF
Co-training pseudo-labeling for text classification with support vector machi...
PDF
Decision Optimization - From Theory to Practice
PDF
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
PDF
Advancing precision in air quality forecasting through machine learning integ...
PDF
Streamline Vulnerability Management From Minimal Images to SBOMs
PPTX
AI-driven Assurance Across Your End-to-end Network With ThousandEyes
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
Lung cancer patients survival prediction using outlier detection and optimize...
PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PDF
Rapid Prototyping: A lecture on prototyping techniques for interface design
PPTX
Build automations faster and more reliably with UiPath ScreenPlay
PDF
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
PDF
A symptom-driven medical diagnosis support model based on machine learning te...
Introduction to MCP and A2A Protocols: Enabling Agent Communication
The AI Revolution in Customer Service - 2025
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
IT-ITes Industry bjjbnkmkhkhknbmhkhmjhjkhj
giants, standing on the shoulders of - by Daniel Stenberg
Examining Bias in AI Generated News Content.pdf
Co-training pseudo-labeling for text classification with support vector machi...
Decision Optimization - From Theory to Practice
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
Advancing precision in air quality forecasting through machine learning integ...
Streamline Vulnerability Management From Minimal Images to SBOMs
AI-driven Assurance Across Your End-to-end Network With ThousandEyes
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
Lung cancer patients survival prediction using outlier detection and optimize...
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
Rapid Prototyping: A lecture on prototyping techniques for interface design
Build automations faster and more reliably with UiPath ScreenPlay
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
A symptom-driven medical diagnosis support model based on machine learning te...

[SF HTML5] Responsive Cross-Device Development with Web Standards (2013)