forked from estelle/mobilecss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkshop.html
More file actions
483 lines (395 loc) · 20 KB
/
workshop.html
File metadata and controls
483 lines (395 loc) · 20 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
<!doctype HTML>
<html>
<head>
<meta charset="utf-8" />
<title>Mobile CSS3: What you need to know</title>
<style></style>
<link href="mobilecss.css" rel="stylesheet" media="projection, screen">
</head>
<body>
<header>
<nav>
<ul>
<li class="button cancel" id="back">Back</li>
<li class="button done" id="next">Next</li>
</ul>
<h1>Mobile CSS3</h1>
</nav>
</header>
<div id="presentation">
<div id="presentation-counter"></div>
<div id="slides">
<!-- Title Slide -->
<div class="slide normal" style="background-image:url(images/broken-lcd.jpg); background-size:cover; background-position: top right">
<header>
</header>
<section>
<h1 style="font-size: 4rem; color: #E65F00" >Mobile CSS3:<br/> Pointers and Pitfalls in the mobile space</h1>
<div style="float:left; -webkit-transform:scale(0.75); -webkit-transform-origin: 0 0;"><img src="http://akamaicovers.oreilly.com/images/9780980846904/cat.gif" alt="HTML5 and CSS3 for the Real World" style="float: left;"><img src="http://akamaicovers.oreilly.com/images/0636920018063/cat.gif" alt="HTML5: The Definitive Guide" style="margin: 0 20px; float:right;"/><br/><img src="http://akamaicovers.oreilly.com/images/0636920021711/cat.gif" alt="MObile HTML5" style="margin: 0 20px 0 0; clear:left"/><img src="http://akamaicovers.oreilly.com/images/0636920025955/cat.gif" alt="Web Performance Daybook"/></div>
<div style="float: right; margin-top: 100px;">Slides: <a href="http://estelle.github.com/mobilcssv">estelle.github.com/mobilecss</a><br/>
Name: Estelle Weyl
<br>Blog: <a href="http://standardista.com">standardista.com</a>
<br>Twitter: <a href="http://twitter.com/estellevw">@estellevw</a></p>
<footer>Photo: <a href="http://www.hdwallpapers4ipad.com/photo/abstract_backgrounds/broken_screen/2-0-1568">hdwallpapers4ipad.com</a></footer>
</section>
</div>
<!-- Fast -->
<div class="slide normal">
<header>
<h1>Fast to ....</h1>
</header>
<section style="height:550px">
<ul style="font-size: 4rem;">
<li style="margin-left: 100px;">Load</li>
<li style="margin-left: 150px;">Render</li>
<li style="margin-left: 200px;">Respond</li>
<li style="margin-left: 250px;">Understand</li>
</ul>
<ul class="temphidden">
<li class="notes">Beautiful</li>
<li class="notes">Useful</li>
<li class="notes">Eco-friendly</li>
</ul>
</section>
</div>
<!--YSLOW -->
<div class="slide normal">
<header>
<h1>YSLOW</h1>
</header>
<section>
<ul class="visibility">
<li>Make fewer HTTP requests
<p class="hidenotes">Decreasing the number of components on a page reduces the number of HTTP requests required to render the page, resulting in faster page loads. Some ways to reduce the number of components include: combine files, combine multiple scripts into one script, combine multiple CSS files into one style sheet, and use CSS Sprites and image maps.</p></li>
<li>Avoid empty src or href
<p class="hidenotes">You may expect a browser to do nothing when it encounters an empty image src. However, it is not the case in most browsers. IE makes a request to the directory in which the page is located; Safari, Chrome, Firefox 3 and earlier make a request to the actual page itself. This behavior could possibly corrupt user data, waste server computing cycles generating a page that will never be viewed, and in the worst case, cripple your servers by sending a large amount of unexpected traffic.</p></li>
<li>Compress components with gzip
<p class="hidenotes">Compression reduces response times by reducing the size of the HTTP response. Gzip is the most popular and effective compression method currently available and generally reduces the response size by about 70%. Approximately 90% of today's Internet traffic travels through browsers that claim to support gzip.</p></li>
<li>Put CSS at top
<p class="hidenotes">Moving style sheets to the document HEAD element helps pages appear to load quicker since this allows pages to render progressively.</p></li>
<li>Put JavaScript at bottom
<p class="hidenotes">JavaScript scripts block parallel downloads; that is, when a script is downloading, the browser will not start any other downloads. To help the page load faster, move scripts to the bottom of the page if they are deferrable.</p></li>
<li>Avoid CSS expressions
<p class="hidenotes">CSS expressions (supported in IE beginning with Version 5) are a powerful, and dangerous, way to dynamically set CSS properties. These expressions are evaluated frequently: when the page is rendered and resized, when the page is scrolled, and even when the user moves the mouse over the page. These frequent evaluations degrade the user experience.
</p></li>
<li>Reduce DNS lookups
<p class="hidenotes">The Domain Name System (DNS) maps hostnames to IP addresses, just like phonebooks map people's names to their phone numbers. When you type URL www.yahoo.com into the browser, the browser contacts a DNS resolver that returns the server's IP address. DNS has a cost; typically it takes 20 to 120 milliseconds for it to look up the IP address for a hostname. The browser cannot download anything from the host until the lookup completes.
</p></li>
<li>Minify JavaScript and CSS
<p class="hidenotes">
Minification removes unnecessary characters from a file to reduce its size, thereby improving load times. When a file is minified, comments and unneeded white space characters (space, newline, and tab) are removed. This improves response time since the size of the download files is reduced.
</p></li>
<li>Avoid URL redirects
<p class="hidenotes">
URL redirects are made using HTTP status codes 301 and 302. They tell the browser to go to another location. Inserting a redirect between the user and the final HTML document delays everything on the page since nothing on the page can be rendered and no components can be downloaded until the HTML document arrives.
</p></li>
<li>Remove duplicate JavaScript and CSS
<p class="hidenotes">
Duplicate JavaScript and CSS files hurt performance by creating unnecessary HTTP requests (IE only) and wasted JavaScript execution (IE and Firefox). In IE, if an external script is included twice and is not cacheable, it generates two HTTP requests during page loading. Even if the script is cacheable, extra HTTP requests occur when the user reloads the page. In both IE and Firefox, duplicate JavaScript scripts cause wasted time evaluating the same scripts more than once. This redundant script execution happens regardless of whether the script is cacheable.
</p></li>
<li> Reduce the number of DOM elements
<p class="hidenotes">
A complex page means more bytes to download, and it also means slower DOM access in JavaScript. Reduce the number of DOM elements on the page to improve performance.</p>
</li>
<li>Avoid HTTP 404 (Not Found) error
<p class="hidenotes">Making an HTTP request and receiving a 404 (Not Found) error is expensive and degrades the user experience. Some sites have helpful 404 messages (for example, "Did you mean ...?"), which may assist the user, but server resources are still wasted.</p></li>
<li> Avoid AlphaImageLoader filter
<p class="hidenotes">The IE-proprietary AlphaImageLoader filter attempts to fix a problem with semi-transparent true color PNG files in IE versions less than Version 7. However, this filter blocks rendering and freezes the browser while the image is being downloaded. Additionally, it increases memory consumption. The problem is further multiplied because it is applied per element, not per image.
</p>
</li>
<li>Do not scale images in HTML
<p class="hidenotes">Web page designers sometimes set image dimensions by using the width and height attributes of the HTML image element. Avoid doing this since it can result in images being larger than needed. For example, if your page requires image myimg.jpg which has dimensions 240x720 but displays it with dimensions 120x360 using the width and height attributes, then the browser will download an image that is larger than necessary.</p></li>
<li>Make favicon small and cacheable
<p class="hidenotes">A favicon is an icon associated with a web page; this icon resides in the favicon.ico file in the server's root. Since the browser requests this file, it needs to be present; if it is missing, the browser returns a 404 error (see "Avoid HTTP 404 (Not Found) error" above). Since favicon.ico resides in the server's root, each time the browser requests this file, the cookies for the server's root are sent. Making the favicon small and reducing the cookie size for the server's root cookies improves performance for retrieving the favicon. Making favicon.ico cacheable avoids frequent requests for it.
</p>
</li>
</ul>
<footer>Click item for more info. Link: <a href="http://developer.yahoo.com/yslow/">YSlow</a></footer>
</section>
</div>
<!-- Page Speed -->
<div class="slide normal">
<header>
<h1>Page Speed </h1>
</header>
<section class="content columns">
<ul>
<li>Leverage browser caching</li>
<li>Enable compression</li>
<li>Defer parsing of JavaScript</li>
<li>Minimize request size</li>
<li>Specify a cache validator</li>
<li>Optimize images</li>
<li>Minify JavaScript</li>
<li>Minify HTML</li>
<li>Specify image dimensions</li>
<li>Specify a character set</li>
<li>Specify a Vary: Accept-Encoding header</li>
<li>Reduce request serialization</li>
<li>Eliminate unnecessary reflows</li>
<li>Avoid long-running scripts</li>
<li>Avoid CSS @import</li>
<li>Avoid bad requests</li>
<li>Enable Keep-Alive</li>
<li>Make landing page redirects cacheable</li>
<li>Minify CSS</li>
<li>Minimize redirects</li>
<li>Optimize the order of styles and scripts</li>
<li>Put CSS in the document head</li>
<li>Remove query strings from static resources</li>
<li>Serve resources from a consistent URL</li>
<li>Serve scaled images</li>
</ul>
<footer><a href="http://code.google.com/speed/page-speed/">Google Page Speed Tools</a></footer>
</section>
</div
<!-- Table of Contents -->
<div class="slide normal" style="background-image:url(images_old/telephonecans.jpg); background-position:80% bottom; background-repeat:no-repeat;">
<header>
<h1>Device limitations!</h1>
</header>
<section>
<ul class="sevenless">
<li>Battery Life</li>
<li>Latency</li>
<li>Memory</li>
<li>UI responsiveness</li>
<li>Plethora of Screen Sizes</li>
</ul>
<h2 style="position:absolute; bottom: 50px; right: 0; left: 0;">Phones aren't Laptops</h2>
</section>
</div>
<!-- BATTERY -->
<div class="slide normal">
<header>
<h1>Battery</h1>
</header>
<section>
<p>CPU Drains the battery. Avoid using it!</p>
<ul class="sevenless">
<li>Minimize the DOM</li>
<li>Avoid reflows</li>
<li>Avoid repaints</li>
<li>Minimize JavaScript (size and activity)</li>
<li>No JavaScript animations</li>
<li>Do you really need library/framework?</li>
</ul>
</section>
<footer><a href="http://www2012.org/proceedings/proceedings/p41.pdf">Who killed my battery - PDF</a></footer>
</div>
<!-- Normal DNS -->
<div class="slide normal">
<header>
<h1>Latency</h1>
<h2 style="text-align:center; font-size: 1.8rem;">Reduce the number of DNS lookups and HTTP Requests </h2>
</header>
<section>
<img src="images/simpledns.gif" style="margin: 40px auto; display: block" alt="Computer asks DNS server for IP address, then goes to IP to get website" />
<p style="text-align:center; position:absolute; bottom: 40px; width: 100%;">Each host is a different lookup!!</p>
</section>
</div>
<!-- Device Memory: CPU comparison -->
<div class="slide normal">
<header><h1>Memory</h1></header>
<section>
<table class="rowed">
<thead>
<tr>
<th>Device</th>
<th>Memory</th>
</tr>
</thead>
<tbody>
<tr>
<td>iPhone 3G</td>
<td>128MB</td>
</tr>
<tr>
<td>iPhone 3GS</td>
<td>256 MB</td>
</tr>
<tr>
<td>HTC Inspire</td>
<td>768 MB</td>
</tr>
<tr>
<td>Galaxy Nexus </td>
<td>1024 MB</td>
</tr>
<tr>
<td>iPad 1</td>
<td>256 MB</td>
</tr>
<tr>
<td>iPod Touch (4) </td>
<td>256 MB</td>
</tr>
<tr>
<td>iPad 3 </td>
<td>1024 MB</td>
</tr>
<tr>
<td>iPad Mini</td>
<td>512 MB</td>
</tr>
<tr>
<td>MacBook Pro</td>
<td>16 GB</td>
</tr>
</tbody>
</table>
<p><strong>Mobile Norm:</strong> 512MB of RAM, with 1GHz Processor<br/><strong style="opacity: 0;">Mobile Norm:</strong> Moving toward 1GB RAM</p>
<h2 class="text-align: center;">Developing without mobile in mind <br>
leads to sloppy App Dev</h2>
</section>
</div>
<!-- HTC Inspire: How much CPU is used without anything running-->
<div class="slide normal">
<header><h1>Browser shares Memory</h1></header>
<section>
<table class="htc">
<thead><tr><td colspan="3">Running Services</td></tr></thead>
<tfoot><tr><td style="background-color:#FCC">Other</td><td colspan="2" style="background-color:#6C9">73MB Avail: 255MB + 182MB in 21</td></tr></tfoot>
<tbody>
<tr><td colspan="2">Calendar</td><td>8.4MB</td></tr>
<tr><td colspan="3">Process:com.htc.bgp</td></tr>
<tr><td rowspan="2"></td><td>ObexService</td><td>31:52:14</td></tr>
<tr><td colspan="2">Started by application: Touch to stop</td></tr>
<tr><td colspan="2">AT&T Navigator</td><td>8.4MB</td></tr>
<tr><td colspan="3">Process: com.telnav.app.android.congular</td></tr>
<tr><td rowspan="2"></td><td>ResoucePreLoader</td><td>Restarting</td></tr>
<tr><td colspan="2">Started by application: Touch to stop</td></tr>
<tr><td colspan="2">AT&T Spots</td><td>2.4MB</td></tr>
<tr><td colspan="3">Process: com.matchboxmobile.wasp</td></tr>
<tr><td rowspan="2"></td><td>WispService</td><td>31:52:14</td></tr>
<tr><td colspan="2">Started by application: Touch to stop</td></tr>
<tr><td colspan="2">Media</td><td>4.1MB</td></tr>
<tr><td colspan="3">Process: android.process.media</td></tr>
<tr><td rowspan="2"></td><td>DownloadService</td><td>31:52:14</td></tr>
<tr><td colspan="2">Started by application: Touch to stop</td></tr>
<tr><td colspan="2">PVWmdrmService</td><td>2.2MB</td></tr>
<tr><td colspan="3">Process: com.pv.wmdrmservice</td></tr>
<tr><td rowspan="2"></td><td>PVWmdrmService</td><td>31:52:14</td></tr>
<tr><td colspan="2">Started by application: Touch to stop</td></tr>
</tbody>
</table>
</section>
</div>
<!-- touch events -->
<div class="slide normal" style="background-image:url(images/gestures.gif); background-size:80%; background-position: 50% 90%">
<header>
<h1>UI responsiveness - Touch Events</h1>
</header>
<section>
<div style="background-image:url(images/touch.gif), url(images/thumbup.jpg), url(images/butler.jpg); background-color:rgba(255,255,255,0.85); background-position: 5% bottom, 45% 95%, 95% 98%; width: 70%; margin: auto; padding: 20px; padding-bottom: 100px; min-height: 100px; border: solid #ccc; border-radius: 15px;">
<ul class="sevenless">
<li>Touch Event: 300 - 500ms delay</li>
<li>Extra touches aren't forgotten</li>
<li>Co-opt with touch events with JS
<ol>
<li>Accept input</li>
<li>Provide user feedback</li>
<li>Update the UI</li>
</ol>
</li>
</ul>
</div>
<footer>Credit: <a href="http://www.lukew.com/touch/TouchGestureGuide.pdf">Luke W.</a></footer>
</section>
</div>
<div class="slide">
<header><h1>Varied Screen Sizes</h1></header>
<section class="content">
<ul class="sevenless">
<li>Smart Phone</li>
<li>Tablet</li>
<li>Laptop</li>
<li>Monitor</li>
<li>TV</li>
<li>Wrist Watch</li>
</ul>
<h2 class="temphidden">portrait v. landscape?</h2>
<h2 class="temphidden">high and low resolution?</h2>
</section>
</div>
<div class="slide intro">
<header><h1>Screen Size</h1></header>
<section class="content">
<h1><a href="responsive.html">Media Queries</a></h1>
<p><a href="responsive.html">short</a> |
longer</p>
</section>
</div>
<div class="slide intro">
<header><h1>Back to the Basics</h1></header>
<section class="content">
<h1><a href="../selectors/30.html">CSS3 Selectors</a></h1>
<p><a href="../selectors/30.html">short</a> |
<a href="../selectors/">longer</a></p>
</section>
</div>
<div class="slide intro">
<header><h1>Back to the Future</h1></header>
<section class="content">
<h1><a href="../gradients/30.html">CSS3 Gradients</a></h1>
<p><a href="../gradients/30.html">short</a> |
<a href="../gradients/">longer</a></p>
</section>
</div>
<div class="slide">
<header><h1>Gradient Exercise: Build this slide deck</h1></header>
<section class="content">
<p></p>
<ol>
<li>Add the gradients in old syntax, prefixed syntax and standard w3 syntax.<li>Remove the unsightly top border on the first list item(using the selectors we learned earlier)</li>
<li>Instead of the origin iPhone look, try the newer grey look and feel. How can you set up your gradients so that switch only takes 1 minute?</li>
</ol>
<p><a href="exercise/iphone/solution.html">Possible Solution</a></p>
<p><a href="exercise/iphone.zip">Download the files</a></p>
</section>
</div>
<div class="slide intro">
<header><h1>Fun Features</h1></header>
<section class="content">
<h1><a href="../animation/30.html">CSS3 Transforms, Transitions & Animations</a></h1>
<p><a href="../animation/30.html">short</a> |
<a href="../animation/">longer</a></p>
<p> </p>
<p><a href="../snow/">Make it snow</a> <br>includes refresher of what we've done so far</p>
</section>
</div>
<div class="slide object">
<header><h1>Pop Quiz</h1></header>
<object data="../snow/index.html"></object>
<a href="../snow/index.html" target="play" class="objectlink">Try it out</a>
</div>
<div class="slide intro">
<header><h1>Mobile Performance</h1></header>
<section class="content">
<h1><a href="../mobileperf/30.html">Mobile CSS3 <br/>Quirks and Pitfalls</a></h1>
<p><a href="../mobileperf/30.html">short</a> |
<a href="../mobileperf/">longer</a></p>
</section>
</div>
<!-- Thank you -->
<div class="slide normal">
<header>
<h1>Thank you</h1>
</header>
<section>
<div style="float:right"><img src="http://akamaicovers.oreilly.com/images/9780980846904/cat.gif" alt="HTML5 and CSS3 for the Real World"><img src="http://akamaicovers.oreilly.com/images/0636920018063/cat.gif" alt="HTML5: The Definitive Guide" style="margin: 0 20px;"/><img src="http://akamaicovers.oreilly.com/images/0636920021711/cat.gif" alt="MObile HTML5" style="margin: 0 20px;"/><img src="http://akamaicovers.oreilly.com/images/0636920025955/cat.gif" alt="Web Performance Daybook"/></div>
<ul class="sevenless">
<li>Estelle Weyl</li>
<li><a href="http://standardista.com">standardista.com</a></li>
<li><a href="http://twitter.com/estellevw">@estellevw</a></li>
</ul>
</section>
</div>
</div>
</div>
<footer>
<p style="float: left;">Press <span class="button">→</span> key to advance.</p> <p style="float:right"><a href="http://www.twitter.com/estellevw">@estellevw</a> · <a href="http://estelle.github.com/mobilecss/">Estelle.Github.com/mobilecss/</a></p>
</footer>
<script src="mobilecss.js"></script>
</body>
</html>