Expanded version of my "Making your site mobile-friendly" speed talk, delivered via Skype for the Russian Internet Technology (RIT) conference, Moscow, 12 April 2010
28. CSS 3 Media Queries
“...the new hotness” Jeffrey Zeldman
http://www.zeldman.com/2010/04/08/best-aea-yet/
29. CSS 3 Media Queries
● build and extend CSS 2.1 Media Types
● more granular control of capabilities
● width, height, orientation, color, resolution, …
http://www.w3.org/TR/css3-mediaqueries/
30. CSS 3 Media Queries
<link rel="stylesheet" ...
media="screen and (max-width:480px)" href="...">
@import url("...") screen and (max-width:480px);
@media screen and (max-width:480px) {
// insert CSS rules here
}
34. viewport meta
● on desktop viewport = visible area of browser
● mobile browsers have “virtual viewport”
● viewport meta gives hints
http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWeb
Content/UsingtheViewport/UsingtheViewport.html
37. minimise data
and server requests
(minify JavaScript, combine CSS, …)
38. minimise data
● data transfer over network can be slow
● compress images (PNGCrush)
● optimise your HTML (death to div-itis)
● minify JavaScript
● combine CSS
39. minimise server requests
● each request has overhead
● limit to concurrent requests
● caching not reliable (e.g. iPhone > 25Kb)
40. CSS sprites
Dave Shea, A List Apart
www.alistapart.com/articles/sprites