forked from raglan-road/responsive-preso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
785 lines (688 loc) · 23.4 KB
/
index.html
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
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
<!DOCTYPE html>
<!--
Google HTML5 slide template
Authors: Luke Mahé (code)
Marcin Wichary (code and design)
Dominic Mazzoni (browser compatibility)
Charles Chen (ChromeVox support)
URL: http://code.google.com/p/html5slides/
-->
<html>
<head>
<title>Presentation</title>
<meta charset='utf-8'>
<script src='./slides.js'></script>
</head>
<style>
.c-space .slides.template-default > article:not(.nobackground):not(.biglogo){
background:#FFF url(http://www.communispace.com/images/cs_logo.png) 725px 600px no-repeat;
}
.smaller{
font-size:75%;
line-height:.65;
}
p.smaller, ul.smaller{
line-height:1;
}
</style>
<body class="c-space" style='display: none'>
<section class='slides layout-regular template-default'>
<!-- Your slides (<article>s) go here. Delete or comment out the
slides below. -->
<article>
<h1>
Responsive Web Design
<br>
<span class="smaller">Or: <em>How You Learned to Stop Worrying and Love Media Queries</em></span>
</h1>
<p>
Adam J. McIntyre
<br>
March 29, 2012
</p>
</article>
</article>
<article>
<h3>
So, what is it exactly?
</h3>
<p>
Responsive Web Design is the practice of designing and building web sites and applications that <em>respond</em> to users' devices: responsive interfaces
will adapt themselves to the user's device in a way that enables the user to transparently use that application regardless of factors like device- or browser- type or screen resolution.
</p>
<p>
When coupled with the techniques of <strong>progressive enhancement</strong>, we can essentially build a user interface that adapts itself to a near-comprehensive set of devices and
browsers, allowing users on any platform to engage in a meaningful experience with our applications.
</p>
</article>
<article>
<h2>But there's alternatives to this, right?</h2>
</article>
<article>
<h3>Alternative: Doing Absolutely Nothing<h3>
<ul class="build">
<li>
Pros:
<ol>
<li>It costs us absolutely no time and effort</li>
<li>The site generally works "well enough" on a sampling of devices…</li>
</ol>
</li>
<li>
Cons:
<ol>
<li>"Well enough" isn't good enough</li>
</ol>
</li>
</ul>
</article>
<article>
<h3>Alternative: Building Native Applications<h3>
<ul class="build">
<li>
Pros:
<ol>
<li>We're building a truly native application, so we have access to a wide-range of device-specific APIs for extra functionality (cameras!)</li>
<li>A native application is guaranteed to look and work just fine on the device it's built for</li>
</ol>
</li>
<li>
Cons:
<ol>
<li>We're in the mobile application business: now we're writing Objective-C or Java and building for a variety of new platforms</li>
<li>We've got a bunch of new applications to develop, test, and maintain</li>
<li>We have to live by App Store policies: Instead of pushing a fix on our own time, we're beholden to the dreaded App Store approval process</li>
</ol>
</li>
</ul>
</article>
<article>
<h3>Alternative: Serving Different Content to Different User Agent (the "mobile" site)<h3>
<div class="build">
<p class="smaller">
.NET MVC 4.0 introduces user agent sniffing by convention and design, which would allow us to change the content we serve up to different user agents and show an iPhone- or Android-specific view instead of our default view.
</p>
<ul class="build smaller">
<li>
Pros:
<ol>
<li>It's targeted: we can build a very specific experience for a specific browser</li>
<li>We're saving bandwidth: we can tailor views to mobile, saving mobile users from receiving huge amounts of markup or images</li>
<li>We have potential access to device APIs via serving up views - including javascript - specific to those devices</li>
</ol>
</li>
<li>
Cons:
<ol>
<li>Is this scalable? We'll end up with views for iPhone, iPad, Android, ∞</li>
<li>How do we handle cross-platform differences within the same device?</li>
<li>Will we always be bogged down by building for the lowest common denominator device on each platform? Is iOS 4 going to be the new IE6, or do we
just drop support for it?</li>
</ol>
</li>
</ul>
</div>
</article>
<article>
<h3>And Responsive Web Design's the Answer?<h3>
<p>
It can be.
</p>
<ul>
<li>
High bang for the buck:
<ul>
<li>Best combination of effort and impact across devices</li>
<li>Rquires <em>very little</em> change to our codebase</li>
</ul>
</li>
<li>
We can forget about "devices" and "browsers" and instead design and build for user experience.
</li>
</ul>
</p>
<p class="smaller">
I, for one, don't want to start debugging differences in iOS 5, iOS 5.1, Android Gingerbread and Android Ice Cream Sandwich alongside IE7, IE9 and Google Chrome. Ew.
</p>
</article>
<article>
<h2> So, how do we make our application responsive?</h2>
</article>
<article>
<h3>
First, we define <em>baseline</em> functionality for each section of the site.
</h3>
<p>
Baseline functionality is just that: it's the level of functionality that we want every user of the site to see, regardless of what device or browser they're using.
It's our site's design and functionality stripped down to the barebones experience: users receive just enough content, styling, and interactivity to accomplish their goal. That's it.
</p>
<p>
What's the baseline functionality for a discussion? Contributing and viewing replies. For a chat? Seeing the stream of contributions and being able to post your own. For a media gallery?
Brainstorm? Probably something along those lines.
</p>
</article>
<article>
<h3>
This is a <em>conversation</em> that leads us into a build process
</h3>
<p>
We're talking to people like stakeholders and product folks to come to an agreement on one basic question: what's the primary goal for a user to accomplish this goal and
what's the minimum level of functionality we need in place to achieve it?
</p>
</article>
<article>
<h2>A segue into Media Queries</h2>
</article>
<article>
<h3>
What exactly are CSS Media Queries?
</h3>
<p>
Media Queries consist of a <em>media type</em> (like screen or print) that applies the contained rules to that specific type of media only and one or more expressions that
set the query's scope.
</p>
<p>
Expressions are usually tests against certain device or browser characteristics, like <code>max-width</code> or <code>device-pixel-ratio</code> (the number of device pixels per CSS pixel; useful for handling retina displays on iOS especially).
</p>
<p class="smaller">
Yes, they can be (ab)used to handle cross-browser differences, too.
</p>
<p class="source">
<a href="https://developer.mozilla.org/en/CSS/Media_queries">Source: Mozilla Developer Network</a>
</p>
</article>
<article>
<h3>What do they look like?</h3>
<pre class="prettyprint">
<style type="text/css">
@media screen, print and (max-width: 320px) {
/* Tiny resolution on an old school device */
#get-a-new-phone{
display:block;
}
}
@media screen, print and (min-width: 960px) {
/* iPhone 4 in landscape mode */
/* More screen => show an "optional" element, like a
special tool or extra info */
#bar{
display:block;
}
#foo{
/* ... */
}
}
</style>
</pre>
</article>
<article>
<h3>
After that, we build a stripped down version of our site
</h3>
<p>
It could be as simple as this:
</p>
<pre class="prettyprint">
<style type="text/css">
/* Baseline discussion - hide elements that we don't need and set up some nice, default styles */
#contentLeftOuter, .simple-search-container, #breadcrumbs, #tags-panel, .ActionIcons, .iconColumn > ul{
display: none;
}
.page-container {
/* We'll be setting the device-width via a meta tag,
so this gives us a nice fullscreen view on a mobile device */
width: 100%;
}
#contentRightOuter {
width: 100%;
}
</style>
</pre>
</article>
<article class="nobackground">
<h3>That looks something like this:</h3>
<iframe src="http://localhost/cafegourmet/DiscussionContribution/Index?GC=true&id=d0288058-fe1a-467f-9e85-47f46e4b794a&parentId=d0288058-fe1a-467f-9e85-47f46e4b794a&CcS=000" style="width:480px;"></iframe>
<p class="source">Yep, this would work on all kinds of devices, too</p>
</article>
<article>
<h2>
In building a baseline, we've essentially covered a huge amount of devices and browsers. They're done.
</h2>
</article>
<article>
<h3>Now we build upon the baseline...</h3>
<p>
Using Media Queries, we can change how elements are styled based on the resolution we have available to us.
</p>
<p>
The magic: as resolution changes (a device flips from portrait to landscape or a user resizes their browser window),
Media Queries <em>just work</em> and automatically apply themselves based on the new specifications reported by the user agent.
</p>
</article>
<article>
<p>
Using our previous example, we might want to show the search bar if there's enough real estate available.
</p>
<p>
If the user's on an iPad in portrait mode or thereabouts, there's plenty of space for our search bar, so we can begin showing it:
</p>
<pre class="prettyprint">
<style type="text/css">
@media screen and (min-width: 640px){
.site-nav-container .simple-search-container{
display:block;
width: 180px;
}
.site-nav-container .simple-search-textbox-item {
width: 30%;
}
}
</style>
</pre>
</article>
<article class="nobackground">
<h3>That looks something like this:</h3>
<iframe src="http://localhost/cafegourmet/DiscussionContribution/Index?GC=true&id=d0288058-fe1a-467f-9e85-47f46e4b794a&parentId=d0288058-fe1a-467f-9e85-47f46e4b794a&CcS=000" style="width:675px;"></iframe>
</article>
<article>
<p class="smaller">
More available screen than that? We can drop back to our full site experience, enhancing the interface with a larger search bar, and a two-column layout with filtering tools.
</p>
<p class="smaller">
800 pixels of screen might be available on certain Android devices or maybe a desktop browser that's not fully maximized (most aren't).
</p>
<pre class="prettyprint">
<style type="text/css">
@media screen and (min-width: 800px) {
.site-nav-container .simple-search-container{
width: 300px;
}
#contentLeftOuter {
display: block;
}
#contentRightOuter {
width: 75%;
}
}
</style>
</pre>
</article>
<article class="nobackground">
<h3>That looks something like this:</h3>
<iframe src="http://localhost/cafegourmet/DiscussionContribution/Index?GC=true&id=d0288058-fe1a-467f-9e85-47f46e4b794a&parentId=d0288058-fe1a-467f-9e85-47f46e4b794a&CcS=000" style="width:818px;"></iframe>
</article>
<article class="nobackground">
<h2>
By starting at our baseline, we ensured that <em>everyone</em> can use the application and users that can receive enhancements to the experience.
<br><br><!-- sorry, I had to do this to fit the default Google Slides template. -->
Our view is exactly the same; our stylesheet reacts differently, controlling presentation as it should.
</h2>
</article>
<article class="nobackground">
<h3>It's not just CSS Media Queries</h3>
<p>
Javascript <em>Feature Detection</em> allows us to take the enhancement further, setting a baseline level of browser support that must be in place before taxing
a browser with added javascript.
</p>
</article>
<article class="nobackground">
<h3>For example...</h3>
<p>
Older or underpowered browsers don't implement the <code>document.querySelectorAll</code> API. What if we save them processing power by only loading certain
javascript libraries if that API is available?
</p>
<pre class="prettyprint">
<script type="text/javascript">
if('querySelectorAll' in document){
// Let's enhance the experience further here.
// Load jQuery, extra widgets, etc. via loader like yepnope
}
else{
// We can load a few low-powered
// alternatives, too.
}
</script>
</pre>
</article>
<article class="nobackground">
<h3>Or better still, what if we add functionality to enhance the experience?</h3>
<pre class="prettyprint">
<script type="text/javascript">
if('getUserMedia' in navigator){
// We have access to the user's device's camera.
// What if we let them upload pictures straight
// from their device?
// If a device or browser doesn't implement this
// API, they don't need to know about it!
}
</script>
</pre>
</article>
<article>
<h3>How do we manage bandwidth?</h3>
<div class="delay">
<p>
We don't want to sock mobile devices with a full download of everything, so how do we limit what we serve?
</p>
Through a combination of:
<ul>
<li>Conditionally loaded scripts and stylesheets</li>
<li>Responsive image loading</li>
<li>And MVC 4.0's mobile-specific templates where we need them</li>
</ul>
</div>
</article>
<article>
<h2>We covered the other two, but <em>responsive images</em>?</h2>
</article>
<article>
<h3>Responsive Images</h3>
<p>
Currently a W3C proposal, responsive images would essentially allow you to specify which version of an image to serve for a certain screen resolution,
allowing you to only serve the largest size necessary for a device, saving bandwidth along the way.
</p>
<p>
While the standard develops, there are <a href="https://github.com/scottjehl/picturefill">working</a> <a href="https://github.com/adamdbradley/foresight.js">implementations</a> of both the technique and the <code>picture</code> element that's the new proposed standard. Are they production ready? Maybe not, but they can get us started in the right direction.
</p>
</article>
<article>
<h2>So in summation...</h2>
</article>
<article>
<h3>Responsive Web Design is...</h3>
<p>
A bit more than CSS Media Queries. It's a way of developing an application so that <em>everyone</em> can use it, regardless of device or browser, with functionality that gradually builds from a baseline experience to a "kitchen-sink" experience on devices and browsers that can handle it.
</p>
<p>
Most importantly, it allows us to abstract away the ideas of "device" and "browser" and think instead of the site experience in terms of availability (of screen) and capability (of platform).
</p>
</article>
<article>
<h3>That'll do it!</h3>
<p>
Questions?
</p>
<p>
Fork these slides <a href="https://github.com/amcintyre-cs/responsive-preso">over on Github</a>.
</p>
</article>
<!--
<article>
<h3>
Simple slide with header and text
</h3>
<p>
This is a slide with just text. This is a slide with just text.
This is a slide with just text. This is a slide with just text.
This is a slide with just text. This is a slide with just text.
</p>
<p>
There is more text just underneath with a <code>code sample: 5px</code>.
</p>
</article>
<article class='smaller'>
<h3>
Simple slide with header and text (small font)
</h3>
<p>
This is a slide with just text. This is a slide with just text.
This is a slide with just text. This is a slide with just text.
This is a slide with just text. This is a slide with just text.
</p>
<p>
There is more text just underneath with a <code>code sample: 5px</code>.
</p>
</article>
<article>
<h3>
Slide with bullet points and a longer title, just because we
can make it longer
</h3>
<ul>
<li>
Use this template to create your presentation
</li>
<li>
Use the provided color palette, box and arrow graphics, and
chart styles
</li>
<li>
Instructions are provided to assist you in using this
presentation template effectively
</li>
<li>
At all times strive to maintain Google's corporate look and feel
</li>
</ul>
</article>
<article>
<h3>
Slide with bullet points that builds
</h3>
<ul class="build">
<li>
This is an example of a list
</li>
<li>
The list items fade in
</li>
<li>
Last one!
</li>
</ul>
<div class="build">
<p>Any element with child nodes can build.</p>
<p>It doesn't have to be a list.</p>
</div>
</article>
<article class='smaller'>
<h3>
Slide with bullet points (small font)
</h3>
<ul>
<li>
Use this template to create your presentation
<li>
Use the provided color palette, box and arrow graphics, and
chart styles
<li>
Instructions are provided to assist you in using this
presentation template effectively
<li>
At all times strive to maintain Google's corporate look and feel
</ul>
</article>
<article>
<h3>
Slide with a table
</h3>
<table>
<tr>
<th>
Name
<th>
Occupation
<tr>
<td>
Luke Mahé
<td>
V.P. of Keepin’ It Real
<tr>
<td>
Marcin Wichary
<td>
The Michael Bay of Doodles
</table>
</article>
<article class='smaller'>
<h3>
Slide with a table (smaller text)
</h3>
<table>
<tr>
<th>
Name
<th>
Occupation
<tr>
<td>
Luke Mahé
<td>
V.P. of Keepin’ It Real
<tr>
<td>
Marcin Wichary
<td>
The Michael Bay of Doodles
</table>
</article>
<article>
<h3>
Styles
</h3>
<ul>
<li>
<span class='red'>class="red"</span>
<li>
<span class='blue'>class="blue"</span>
<li>
<span class='green'>class="green"</span>
<li>
<span class='yellow'>class="yellow"</span>
<li>
<span class='black'>class="black"</span>
<li>
<span class='white'>class="white"</span>
<li>
<b>bold</b> and <i>italic</i>
</ul>
</article>
<article>
<h2>
Segue slide
</h2>
</article>
<article>
<h3>
Slide with an image
</h3>
<p>
<img style='height: 500px' src='images/example-graph.png'>
</p>
<div class='source'>
Source: Sergey Brin
</div>
</article>
<article>
<h3>
Slide with an image (centered)
</h3>
<p>
<img class='centered' style='height: 500px' src='images/example-graph.png'>
</p>
<div class='source'>
Source: Larry Page
</div>
</article>
<article class='fill'>
<h3>
Image filling the slide (with optional header)
</h3>
<p>
<img src='images/example-cat.jpg'>
</p>
<div class='source white'>
Source: Eric Schmidt
</div>
</article>
<article>
<h3>
This slide has some code
</h3>
<section>
<pre>
<script type='text/javascript'>
// Say hello world until the user starts questioning
// the meaningfulness of their existence.
function helloWorld(world) {
for (var i = 42; --i >= 0;) {
alert('Hello ' + String(world));
}
}
</script>
<style>
p { color: pink }
b { color: blue }
u { color: 'umber' }
</style>
</pre>
</section>
</article>
<article class='smaller'>
<h3>
This slide has some code (small font)
</h3>
<section>
<pre>
<script type='text/javascript'>
// Say hello world until the user starts questioning
// the meaningfulness of their existence.
function helloWorld(world) {
for (var i = 42; --i >= 0;) {
alert('Hello ' + String(world));
}
}
</script>
<style>
p { color: pink }
b { color: blue }
u { color: 'umber' }
</style>
</pre>
</section>
</article>
<article>
<q>
The best way to predict the future is to invent it.
</q>
<div class='author'>
Alan Kay
</div>
</article>
<article class='smaller'>
<q>
A distributed system is one in which the failure of a computer
you didn’t even know existed can render your own computer unusable.
</q>
<div class='author'>
Leslie Lamport
</div>
</article>
<article class='nobackground'>
<h3>
A slide with an embed + title
</h3>
<iframe src='http://www.google.com/doodle4google/history.html'></iframe>
</article>
<article class='nobackground'>
<iframe src='http://www.google.com/doodle4google/history.html'></iframe>
</article>
<article class='fill'>
<h3>
Full-slide embed with (optional) slide title on top
</h3>
<iframe src='http://www.google.com/doodle4google/history.html'></iframe>
</article>
<article>
<h3>
Thank you!
</h3>
<ul>
<li>
<a href='http://www.google.com'>google.com</a>
</ul>
</article>
-->
</section>
</body>
</html>