Web Development for Mobile: GTUG Talk at Google

49
Estelle Weyl http://standardista.com http://evotech.net/blog @estellevw Mobile Web Development

description

You no longer have to wait to use HTML5 and CSS3: in developing for mobile, you don't have to worry about archaic browser. Webkit, the browser engine found on Android and iPhone provide excellent support for CSS3 and HTML5. In this session we learn how we can use these new technologies to create mobile web applications.

Transcript of Web Development for Mobile: GTUG Talk at Google

Page 1: Web Development for Mobile: GTUG Talk at Google

Estelle Weylhttp://standardista.comhttp://evotech.net/blog

@estellevw

Mobile Web Development

Page 2: Web Development for Mobile: GTUG Talk at Google

Native or Web???Native Web Depends

Cosmetics ✔

Functionality

Development

Testing ✔

Distribution ✔

Payment ✔

Support ✔

Source: Jonathan Stark

Page 3: Web Development for Mobile: GTUG Talk at Google
Page 4: Web Development for Mobile: GTUG Talk at Google

With HTML5 & CSS3Native Web

Cosmetics ✔ ✔

Functionality ✔ ✔*

Development ✔

Testing ✔

Distribution ✔

Payment ✔

Support ✔

Page 5: Web Development for Mobile: GTUG Talk at Google

http://findmebyip.com/litmus/

Page 6: Web Development for Mobile: GTUG Talk at Google

CSS2.1

Page 7: Web Development for Mobile: GTUG Talk at Google

CSS3Unfinished, but well supported

Page 8: Web Development for Mobile: GTUG Talk at Google

iPhone/Android = Webkit

No Cross browser testing!!!

Page 9: Web Development for Mobile: GTUG Talk at Google

CSS3

Mobile Webkit Supports all of CSS3

Mobile Webkit Supports HTML5

almost

^

^much of

Page 10: Web Development for Mobile: GTUG Talk at Google

CSS3 Properties CSS3 Selectors

HSLA / RGBA

Multiple backgrounds

Background-size

Border-radius

Border-image

Text Shadow

Box Shadow

Opacity10

Text-overflow

Gradients

Transforms

Columns

Animations

Transitions

Border-image

Reflections

@font-face

Page 11: Web Development for Mobile: GTUG Talk at Google

HTML5 APIs

Local Storage

Session Storage

WebSQL dB

Offline Applications

GeoLocation

postMessage

11

Query selector ??

Drag & Drop

<canvas>, <svg>, <audio>, <video>

Web Forms

Page 12: Web Development for Mobile: GTUG Talk at Google

HTML5 <input> Types

date /time / datetime / datetime-local / month / week

email

url

12

Tel

Number

Range

search

Page 13: Web Development for Mobile: GTUG Talk at Google

Input Behavior

Keyboard support ≠ Input Type Support

Page 14: Web Development for Mobile: GTUG Talk at Google

14

iPhone v. Android v. desktop

Input file type does Not work on iPhone.

<a href=“tel:14155551212>Call me</a>

mailto: opens mail application

google maps, iTunes and Youtube links open widgets on iPhone

view source debugger ✔

Page 15: Web Development for Mobile: GTUG Talk at Google

15

Mobile Simulators

Page 16: Web Development for Mobile: GTUG Talk at Google

16

Debugging?

Switch user agent to iPhone / Other

Use Web Inspector to debug

Page 17: Web Development for Mobile: GTUG Talk at Google

Firebug for Mobile?Settings > Safari > Developer > Debug Console

Android Debug Bridge (ADB)

Page 18: Web Development for Mobile: GTUG Talk at Google

Beautiful bookmarks

<link rel="apple-touch-icon" href="/iphoneicon.png" />apple-touch-icon.png

(or apple-touch-icon-precomposed.png)

Page 19: Web Development for Mobile: GTUG Talk at Google

Android bookmarks

<link rel="apple-touch-icon" href="/iphoneicon.png" />apple-touch-icon.png

Page 20: Web Development for Mobile: GTUG Talk at Google

Mobile web app settings

<link rel="apple-touch-startup-image" href="/startup.png">

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

<meta name="apple-mobile-web-app-status-bar-style" content=“default || black || black-translucent" /> (iPhone only)

Page 21: Web Development for Mobile: GTUG Talk at Google

21

Targeting Mobile

Viewport:<meta name="viewport" content="width=980”/><meta name="viewport" content="width=device-width”/><meta name="viewport" content="user-scalable=no, width=device-width"/>

Prohibit Zoom / Pinch:<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />

Page 22: Web Development for Mobile: GTUG Talk at Google

22

@media queries min-width max-width device-width min-device-width max-device-width orientation -webkit-min-device-pixel-ratio

@media screen and (max-device-width: 480px){ /* small screen CSS here */ }

Page 23: Web Development for Mobile: GTUG Talk at Google

@media screen and (???){ …}

Portrait & Landscape (min-width: 320px) and (max-width: 480px)

Portrait & Landscape (min-device-width: 320px) and (max-device-width: 480px)

Portrait & Landscape (max-device-width: 480px)

Landscape only(min-width: 321px) and (max-width: 480px)

Portrait only (max-width: 320px)

Page 24: Web Development for Mobile: GTUG Talk at Google

iPadPortrait & Landscape (min-device-width: 768px) and (max-device-width: 1024px)

Landscape only(min-device-width: 481px) and

(max-device-width: 1024px) and (orientation: landscape)

Portrait only (min-device-width: 481px) and (max-device-width: 1024px) and (orientation: portrait)

Page 25: Web Development for Mobile: GTUG Talk at Google
Page 26: Web Development for Mobile: GTUG Talk at Google

Hide the Title bar

<script>

addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false);

function hideURLbar(){ window.scrollTo(0,1);

}

}

</script>

Page 27: Web Development for Mobile: GTUG Talk at Google

Don’t reinvent the wheel

Page 28: Web Development for Mobile: GTUG Talk at Google

Sencha Touchhttp://glyphish.com/http://graffletopia.com/stencils

Page 29: Web Development for Mobile: GTUG Talk at Google

29http://10k.aneventapart.com

Page 30: Web Development for Mobile: GTUG Talk at Google
Page 31: Web Development for Mobile: GTUG Talk at Google
Page 32: Web Development for Mobile: GTUG Talk at Google

Gradients

Page 33: Web Development for Mobile: GTUG Talk at Google

http://www.westciv.com/tools/gradients/

Page 34: Web Development for Mobile: GTUG Talk at Google

text-shadow: color leftoffset topoffset blur;

Page 35: Web Development for Mobile: GTUG Talk at Google
Page 36: Web Development for Mobile: GTUG Talk at Google
Page 37: Web Development for Mobile: GTUG Talk at Google
Page 38: Web Development for Mobile: GTUG Talk at Google

foo {

background-image: url(foo.png);

-moz-background-size: 100% 50%; //FF3.6

-o-background-size: 100% 50%; //O 9.5

-webkit-background-size: 100% 50%; //Saf 3.0            

background-size: 100% 50%;

}

Page 39: Web Development for Mobile: GTUG Talk at Google
Page 40: Web Development for Mobile: GTUG Talk at Google
Page 41: Web Development for Mobile: GTUG Talk at Google

41

CSS3 Selectors

:nth-of-type()

tr:nth-of-type(even) td{ background-color: #dedede;}

Page 42: Web Development for Mobile: GTUG Talk at Google

translate() -webkit-transform: translate(15px, -15px); transform: translate(15px, -15px);

translateX() -webkit-transform: translatex(15px); transform: translatex(15px); translateY() -webkit-transform: translatey(-15px);

transform: translatey(-15px); scale() -webkit-transform: scale(1.5, 2); transform: scale(1.5, 2); scaleX() -webkit-transform: scalex(0.5); transform: scalex(0.5); scaleY() -webkit-transform: scaley(2);

transform: scaley(2); 

Transforms

Page 43: Web Development for Mobile: GTUG Talk at Google

rotate() -webkit-transform: rotate(15deg); transform: rotate(15deg)

 skew() -webkit-transform: skew(15deg, 4deg); transform: skew(15deg, 4deg); skewX() -webkit-transform: skewx(15deg);

transform: skewx(15deg); skewY() -webkit-transform: skewy(-3deg); transform: skewy(-3deg);

Multiple transforms.enlargen:hover {

-webkit-transform: translate(-50%, -50%) scale(2) rotate(0); transform: translate(-50%, -50%) scale(2) rotate(0);} 

Page 44: Web Development for Mobile: GTUG Talk at Google

transition-property

transition-duration

transition-timing-function ease || linear || ease-in-out || ease-in || ease-out || cubic-bezier()

transition-delay

Transitions

Page 45: Web Development for Mobile: GTUG Talk at Google

Multiple Transitions

or ‘all’

Page 46: Web Development for Mobile: GTUG Talk at Google

Animation

Page 47: Web Development for Mobile: GTUG Talk at Google

Animation animation-name, animation-duration, animation-timing-function

ease, linear, ease-in-out, ease-in, ease-out, cubic-bezier() animation-delay animation-iteration-count

n || infiniteanimation-direction

alternate || normal

Page 48: Web Development for Mobile: GTUG Talk at Google

48

Thanks.

Estelle Weyl

Twitter: @estellevw

Blog: http://www.standardista.com

http://evotech.net/blog

Page 49: Web Development for Mobile: GTUG Talk at Google

49

Credits

http://www.flickr.com/photos/nrkbeta/3905907681

Marius Arnesen