A talk given at Appspirina workshop on March 29th, 2012 organized by http://mobiledeveloper.pl/.
Event page: https://www.facebook.com/events/296799847060237/
4. Source: Justin Avery (CC BY-SA 3.0)
Interfaces don’t have to
look the same everywhere.
TV already solved this problem.
5. “Android WebKit
is the closest thing to being
the IE6 of mobile development for me.”
Dion Almaer, A day in the life of Android WebKit dealings
http://www.flickr.com/photos/thebetancourts/899849126/
6. We know There are
features: constraints:
✦ screen size ✦ screen size
✦ local storage ✦ no touch
✦ touch ✦ poor JavaScript
✦ canvas ✦ no canvas
✦ SVG ✦ isMSIE
Hat tip: Yiibu
10. Party like it’s 1998!
<link rel="stylesheet" media="screen, projection" href="normal.css">
<link rel="stylesheet" media="print" href="print.css">
CSS2 media types
11. CSS3 Media Queries
<link rel="stylesheet" type="text/css"
href="example.css" media="screen and (color)">
Media type Expression
12. Better CSS3 Media Queries
Increase maintainability with @import:
@import url("example.css") screen and (color);
Save HTTP requests:
@media screen and (color) {
body { background: #f00; }
}
13. max/min
-width or
-device-width?
✦ former updates on orientation change, latter doesn’t
✦ only max/min-width will be visible in desktop browser
14. Detect high DPI screens
Just retina display:
<link rel="stylesheet"
media="only screen and (-webkit-min-device-pixel-ratio: 2)"
type="text/css" href="highdpi.css" />
15. “Remove iPhone from ass.”
PPK, The iPhone obsession
http://www.flickr.com/photos/redux/5065152716/
16. Detect high DPI screens
Saves HTTP request, non-iOS-specific:
@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--moz-device-pixel-ratio: 1.5),
only screen and (min-device-pixel-ratio: 1.5) {
/* Styles */
}
17. Detect iPad orientation
<link rel="stylesheet"
media="all and (orientation: landscape)"
href="landscape.css">
<link rel="stylesheet"
media="all and (orientation: portrait)"
href="portrait.css">
18. Test it!
• Screenfly
• Responsive Design
Testing
• Responsive Design
Test Bookmarklet
22. Viewport demystified
<meta name="viewport" content="width=device-width, initial-scale=1.0">
width=500 Custom width setting
minimum-scale=1.0 Prevents from zooming out
maximum-scale=1.0 Prevents from zooming in. Useful with forms
user-scalable=no Use cautiously. Mostly for mobile-specific designs
27. Hiding address bar
After adding as a bookmark:
<meta name="apple-mobile-web-app-capable" content="yes">
Cross-browser solution:
https://github.com/scottjehl/Hide-Address-Bar
33. Load resources conditionally
The Boston Globe used the following methodology:
ASSETS DESIGN
depend on depends on
screen window
dimensions dimensions
60. 1. Complete plugins
✦ WPTouch
✦ Wordpress Mobile Pack
✦ MobilePress
WPTouch plugin used on
Stephen Fry’s website
61. 2. Responsive themes
✦ Twenty ten fully responsive
equivalent available
✦ List of responsive themes
at Free Themes Directory grows constantly
✦ Lots of responsive premium themes
on Forest, WooThemes and Themify
http://responsivetwentyten.com/
62. 3. Theme switchers
Theme switchers usually base on user agent sniffing
to serve users separate WordPress theme.
✦ Wordpress Mobile Pack
✦ Mobile Smart
✦ Device Theme Switcher
70. Building your pool of devices
✦ Analyze your website’s traffic
✦ Review the local platform landscape
✦ Check against device-specific factors
(form, screen size, performance, DPI)
✦ Compare with project-specific factors
(location-based?)
— Stephanie Rieger,
http://stephanierieger.com/strategies-for-choosing-test-devices/
71. Thanks!
Q&A
Wojtek Zając (@theanxy)
This work is licensed
http://www.slideshare.net/wojciechzajac under a Creative
Commons Attribution
3.0 Unported License
72. Credit where it’s due
Based on the brilliant research and works by:
• Scott Jehl • Matt Wilcox • Yiibu.com
• Patrick H. Lauke • Brad Frost
• Russ Weakley • Rachel McCollin
& others.
First slide photo: http://www.flickr.com/photos/johnmcnab/5758738799/
Stephanie Rieger: http://www.flickr.com/photos/29022619@N03/6116794697/