Skip to content

Instantly share code, notes, and snippets.

@davidcalhoun
Created August 28, 2011 20:18
Show Gist options
  • Save davidcalhoun/1177166 to your computer and use it in GitHub Desktop.
Save davidcalhoun/1177166 to your computer and use it in GitHub Desktop.
HTML5 and the Mobile Web

Book outline

Overview

  • what this book is not: focus on supporting older phones, WAP and older standards
  • Focus on the future: the shift towards HTML5. making the case, showing the data, etc

Thinking differently

  • big differences on mobile: screen orientation, screen sizes, geolocation, accelerometer, usage, battery, hover states are awkward, etc.

Mobile First? More common: Mobile Last

  • the unfortunate reality and practical development

Approaches to building

  • should we try to emulate native interfaces?
  • responsive design
  • separate sites
  • hybrid (PhoneGap)
  • to m. or not to m.: bad for search engines?

Making it play nicely with your server

  • the woes of mobile redirects, WURFL, feature detection

Design considerations

  • no more fixed-width websites. All fluid.
  • viewport: zoomable? pinch and double tap to zoom
  • http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
  • simple, one column, buttons, etc. alert/confirm/prompt not such a huge sin?
  • Supported features (a la Modernizr) != usable features (http://code.google.com/p/android/issues/detail?id=14152, etc)
  • Just because you can do something doesn't mean you should do it. Excess use of fancy CSS3 stuff (not just transitions/animations) is bad for performance. See performance chapter for more info.
  • mocks should be made in double resolution: 640x860 for iPhone retina, high resolution screens.

Laying the groundwork

  • viewport, touch icon, startup image, etc

Offline web apps

HTML

  • input types, validation, etc.

CSS

  • all relative units - avoid px measurements where possible. One font-size:px on the body, everything else is font-size:em or rem (http://snook.ca/archives/html_and_css/font-size-with-rem). Width/height/padding should all be in em/%
  • use CSS Zoom when building mobile UI controls
  • media queries, gradients, animations, advanced selectors, etc.
  • HW-accelerated transitions/animations: use -webkit-backface-visibility: hidden; to eliminate flickering
  • -webkit-background-clip: padding; /* prevent border-radius bleedthrough */
  • translate3d z-index issues

JavaScript

orientation changes, accelerometer, geolocation, etc.

Performance

HW acceleration

http://www.sencha.com/blog/understanding-hardware-acceleration-on-mobile-browsers/

Safari

http://mir.aculo.us/2011/02/08/visualizing-webkits-hardware-acceleration/

  1. $ CA_COLOR_OPAQUE=1 /Applications/Safari.app/Contents/MacOS/Safari

OR

  1. Open a terminal
  2. $ defaults write com.apple.Safari IncludeInternalDebugMenu 1
  3. Open (or restart) Safari
  4. Debug -> Show Compositing Borders

Chrome

  1. Type the following in the address bar: about:flags
  2. "Composited render layer borders" -> Enable

Firefox

https://bugzilla.mozilla.org/show_bug.cgi?id=690064

Onclick delay

http://code.google.com/mobile/articles/fast_buttons.html

Symbols instead of images

  1. UTF-8
  2. Emoji

Accessibility

  • aria, VoiceOver, etc.
  • links, checkboxes, any interactive elements hidden offscreen are text only: get announced by screen reader, but aren't interactive
  • don't use negative text-indent: makes the element much larger. Bigger memory footprint and CPU burden (cf. Netflix (http://dl.dropbox.com/u/5618867/mseeley-2011-09-27-html5devconf.pdf))

Testing

Fallbacks

  • making an experience for feature phones (dumb phones). The evil world of carrier transcoders

Appendix 1: Tools of the trade

Appendix 2: Mobile JavaScript libraries and frameworks

Appendix 3: Mobile HTML, CSS, and JavaScript

Appendix 4: Other resources

Appendix 5: Etc.

  • For presentations: use videos, simulator, Elmo projector, or webcam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment