-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
1222 lines (1051 loc) · 46.8 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
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Responsive Web Design, Girl Develop IT</title>
<meta name="description" content="This is the Girl Develop It Responsive Web Design course. Materials by Catherine Farman, based on material by Sophie Shepherd.
The course is meant to be taught in 1 5-hour workshop. Each of the slides and practice files are customizable according to the needs of a given class or audience.">
<meta name="author" content="Girl Develop It">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="reveal.js/css/reveal.css">
<link rel="stylesheet" href="reveal.js/css/theme/css/gdisunny.css" id="theme">
<!-- For syntax highlighting -->
<!-- light editor--><link rel="stylesheet" href="reveal.js/lib/css/light.css">
<!-- dark editor<link rel="stylesheet" href="reveal.js/lib/css/dark.css"> -->
<!-- If use the PDF print sheet so students can print slides-->
<link rel="stylesheet" href="reveal.js/css/print/pdf.css" type="text/css" media="print">
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<!-- Opening slide -->
<section>
<img src = "images/gdi_logo_badge.png" class="badge">
<h3>Responsive Web Design</h3>
<a href="http://cfarm.github.io/gdi-rwd-workshop">cfarm.github.io/gdi-rwd-workshop</a></br>
<a href="http://cfarm.github.io/gdi-rwd-workshop/gdi-rwd-workshop.zip">Download Slides</a>
</section>
<!-- Welcome-->
<section>
<h3>Welcome!</h3>
<div>
<p>Girl Develop It is here to provide affordable and accessible programs to learn software through mentorship and hands-on instruction.</p>
<p class ="green">Some "rules"</p>
<ul>
<li>We are here for you!</li>
<li>Every question is important</li>
<li>Help each other</li>
<li>Have fun</li>
</ul>
</div>
</section>
<section>
<h3>Welcome!</h3>
<div class = "left-align">
<p>I'm Catherine Farman</p>
<ul>
<li>Developer at Happy Cog</li>
<li>I write HTML, CSS and Javascript</li>
<li>Responsive sites I've worked on are <a href="http://benjerry.com">Ben & Jerry's</a> and <a href="http://yarn.com">Yarn.com</a></li>
</ul>
</div>
</section>
<section>
<h3>Welcome!</h3>
<div class = "left-align">
<p class = "blue">Tell us about yourself.</p>
<ul>
<li>Who are you?</li>
<li>What do you hope to get out of the class?</li>
<li>What's something no one in this room knows about you?</li>
</ul>
</div>
</section>
<!-- Terms-->
<section>
<h3>Terms</h3>
<ul>
<li>
<div class = "blue">Responsive Design</div>
<div>Fluid grids + Flexible Images/Video + Media Queries</div>
</li>
<li>
<div class = "blue">Viewport</div>
<div>The visible area of a webpage in a browser window</div>
</li>
<li>
<div class = "red">Mobile App</div>
<div>Software that is downloaded to a mobile device - we will not cover this.</div>
</li>
<li>
<div class = "red">Mobile website</div>
<div>A separate website with its own domain built to target 'mobile devices', typically meaning smartphones. We're not covering this either.</div>
</li>
</ul>
</section>
<!-- Tools -->
<section>
<h3>Tools</h3>
<ul>
<li>
<div class = "yellow">Browser:</div>
<div>Chrome</div>
<div>Firefox</div>
</li>
<li>
<div class = "yellow">Development Toolkit:</div>
<div>Chrome - Inspector</div>
<div>Firefox - Firebug</div>
</li>
<li>
<div class = "yellow">Text Editor:</div>
<div><a href="http://www.sublimetext.com/">Sublime Text - Mac or Windows</a><br>
<a href="http://www.sublimetext.com/">sublimetext.com</a></div>
</li>
</ul>
</section>
<!-- Nitty gritty 1 - What is RWD? -->
<section>
<h3>What is Responsive Web Design?</h3>
<blockquote class="quote">Responsive web design is an approach to web design in which a site is crafted to provide an optimal viewing experience—easy reading and navigation with a minimum of resizing, panning, and scrolling— <em>across a wide range of devices (from desktop computer monitors to mobile phones)</em>.</blockquote>
<cite>-Wikipedia</cite>
</section>
<!-- Examples -->
<section>
<h3>Examples</h3>
<ul>
<li><a href="http://www.bostonglobe.com/">Boston Globe</a></li>
<li><a href="http://www.smashingmagazine.com/">Smashing Magazine</a></li>
<li><a href="http://worldwildlife.org/">World Wildlife Fund</a></li>
<li><a href="http://mediaqueri.es/">Media Queries</a></li>
</ul>
</section>
<!-- Why does it matter? -->
<section>
<h3>Why bother?</h3>
<p>As of May 2013:</p>
<ul>
<li>56% of American adults have a smartphone</li>
<li>28% of cell owners own an Android</li>
<li>25% own an iPhone</li>
<li>4% own a Blackberry</li>
<li>34% of American adults own a tablet computer</li>
</ul>
</section>
<!-- Today's First Goal -->
<section>
<h3>Goal #1</h3>
<div>
Create a page that changes when you resize the browser viewport, and that fits on a mobile device screen.
</div>
<ul>
<li><a href="images/design.jpg">design.jpg</a></li>
<li><a href="images/design.psd">design.psd</a></li>
<li><a href="https://cfarm.github.
io/gdi-rwd-workshop/templates.zip">Open template files (<u>cfarm.github.io/gdi-rwd-workshop/templates.zip</u>)</a></li>
</ul>
</section>
<!-- 3 Keys to RWD-->
<section>
<h3>Four Keys to Responsive Design</h3>
<ul>
<li>A Fluid Grid</li>
<li>Flexible Images</li>
<li>Media Queries</li>
<li>Viewport Meta Tag</li>
</ul>
</section>
<!--Fluid Grid -->
<section>
<h3>The Fluid Grid</h3>
<ul>
<li>Define container widths as % instead of px</li>
<li>Target ÷ context = result <span class="blue">(Important - write this down!)</span></li>
</ul>
</section>
<!-- Target ÷ context = result -->
<section>
<h3>Target ÷ context = result</h3>
<ul>
<li>Target = width you desire in pixels</li>
<li>Context = the container of the element - a div or could be the viewport</li>
<li>Result is a percentage value you can use as a width in your CSS</li>
</ul>
</section>
<section>
<h3>The Fluid Grid</h3>
<img src="images/examplegrid_target.png" alt="480 pixel div target width">
</section>
<section>
<h3>The Fluid Grid</h3>
<img src="images/examplegrid_context.png" alt="960 pixel div container width">
</section>
<section>
<h3>The Fluid Grid</h3>
<div class="giant">
480px ÷ 960px = <br>
<strong>.50</strong>
</div>
</section>
<section>
<h3>The Fluid Grid</h3>
<div class="giant">
.50 =<br>
<strong class="green">50%</strong>
</div>
</section>
<section>
<h3>The Fluid Grid</h3>
<img src="images/examplegrid_target_percent.png" alt="fluid div with percentage width">
</section>
<section>
<h3>The Fluid Grid</h3>
<img src="images/examplegrid_all_percent.png" alt="fluid grid with percentages for all divs">
</section>
<section>
<h3>The Fluid Grid</h3>
<div>
<pre><code contenteditable class ="css">.container {
width: 960px;
margin: 0 20px;
}
.main-column {
width: 480px;
margin-right: 20px;
}
.hero-image {
width: 400px;
}</code></pre>
</div>
</section>
<section>
<h3>The Fluid Grid</h3>
<div>
<pre><code contenteditable class ="css">.container {
width: 960px;
margin: 0 4.1667%;
}
.main-column {
width: 50%;
margin-right: 4.1667%;
}
.hero-image {
width: 41.667%;
}</code></pre>
</div>
</section>
<!-- Exercise-->
<section>
<h3>Let's Develop It</h3>
<ul>
<li>Open up your template index.html file in a browser</li>
<li>Open style.css in the css folder in a text editor</li>
<li>Make your page layout fluid!</li>
<li>Hint: try this helpful calculator at <a href="http://www.rwdcalc.com/">rwdcalc.com</a></li>
<!-- <li>Bonus: Test on devices by uploading your files via <a href="class1.html#/23">FTP</a></li> -->
</ul>
<div>
<pre><code contenteditable class ="css">.container {
width: 100%;
margin: 0 4.1667%;
}
.main-column {
width: 50%;
margin-right: 4.1667%;
}</code></pre>
</div>
</section>
<section>
<h3>Take a look on a "phone" or "tablet"</h3>
<ul>
<li>In Chrome, open the Dev tools (View > Developer > Developer Tools) and follow <a href="http://www.sitepoint.com/use-mobile-emulation-mode-chrome/">these instructions</a></li>
<li>In Firefox, select "Responsive Design View" from the Web Developer submenu in Tools or Menu list (<a href="https://developer.mozilla.org/en-US/docs/Tools/Responsive_Design_View">See instructions</a>)</li>
</ul>
</section>
<section>
<h3>Viewport <meta> Tag</h3>
<p>Makes your page scale correctly on mobile devices.</p>
<div>
<pre style="width: 900px"><code contenteditable class ="html"><meta name="viewport" content="width=device-width"></code></pre>
</div>
<p>Uncomment line 18 in your index.html file and compare on a mobile device to see the difference.</p>
<img src="images/no_meta_tag.png" class="fragment" width="300" />
<img src="images/meta_tag.png" class="fragment" width="300" />
</section>
<!-- Flexible Images -->
<section>
<h3>Flexible Images</h3>
<p>Like with fluid grids, percentages make images flexible in a page</p>
<pre><code contenteditable class ="css">img {
max-width: 100%;
}</code></pre>
</section>
<section>
<h3>Let's Develop It</h3>
<p>Find the following code in your hero-image div:</p>
<pre><code class ="html"><img src="http://placekitten.com/400/300"
alt="pensive kitten">
</code></pre>
<p>What happens when you resize the page to make it small or big?</p>
<div class="fragment">Now add this to your style.css:
<pre><code class ="html"> img {
max-width: 100%;
}
</code></pre>
</div>
</section>
<section>
<h3>Flexible Images</h3>
<p>What if you don’t want it to be 100% wide?</p>
<pre><code class ="html"><img src="http://placekitten.com/400/300"
alt="pensive kitten"
class="small-image">
</code></pre>
<pre><code class ="html">.small-image {
float: left;
width: 50%;
}
</code></pre>
</section>
<section>
<h3>Let's Develop It</h3>
<p>Using percentage widths & flexible images, add "Viral GIFs" photos to match <a href="images/design.jpg">our design</a>:</p>
<ul>
<li>Use <a href="http://placekitten.com">placekitten.com</a> (or <a href="http://placepuppy.it/">placepuppy.com</a> if you must)</li>
<li>Add 9 small images to your HTML</li>
<li>Use floats + percentage widths in your CSS</li>
</ul>
<a href="images/design.jpg"><img src="images/design_images.jpg" alt="Images in our mockup" width="600"></a>
</section>
<!-- Review Quiz!! -->
<section>
<h3>The Fluid Grid</h3>
<p class="left-align">Q: For fluid grids, container widths should use <span class="red">___?</span> instead of pixels</p>
<p class="green left-align fragment">A: Percentages</li>
</ul>
</section>
<!-- Review Quiz!!! -->
<section>
<h3>The Fluid Grid</h3>
<p class="left-align">Q: What is the formula to calculate your width percentage?</p>
<p class="green left-align fragment">A: Target ÷ context = result</span></li>
</ul>
</section>
<!-- Review Quiz!!! -->
<section>
<h3>Viewport <meta Tag></h3>
<p class="left-align">Q: The Viewport <meta> tag changes the <span class="red">_____?</span> of your HTML document:</p>
<ol style="list-style-type: upper-alpha;" class="left-align">
<li class="left-align">Width</li>
<li class="left-align">Aspect Ratio</li>
<li class="left-align">Scale</li>
<li class="left-align">Height</li>
</ol>
<p class="green left-align fragment">A: C. Scale</p>
</ul>
</section>
<!-- Goal #2 -->
<section>
<h3>Goal #2</h3>
<div>
Add media queries to optimize our layout for different screen sizes - making a mobile-first website!
</div>
</section>
<section>
<h3>Max Width Styles</h3>
<p class="left-align">For many responsive styles, you want to impose a maximum width on your elements that have percentage values:</p>
<pre><code class ="css">.gifs img {
width: 33%;
max-width: 85px;
}
</code></pre>
</section>
<section>
<h3>Let's Develop It</h3>
<ul class="left-align">
<li>Add max-width values to your elements with percentages.</li>
<li>Hint: Use your old <strong>pixel width values</strong> for your max-width values. (Aren't you glad you kept those in a comment?)</li>
</ul>
<pre><code class ="css">.gifs img {
width: 33%;
max-width: 85px;
}
.container {
width: 100%;
max-width: 960px;
}
</code></pre>
</section>
<section>
<h3>Fluid Video, etc.</h3>
<ul>
<li>Video, slideshows, etc can also be made flexible</li>
<li>For video: <a href="http://fitvidsjs.com/">FitVids.js</a> jQuery plugin</li>
<li>Or, just add a max-width: 100% (or other value)!</li>
</ul>
</section>
<section>
<h3>Let's Develop It!</h3>
<ul>
<li>Find a cute cat video on Youtube.com</li>
<li>Add the embed code to your HTML</li>
<li>Add a flexible width and a max-width to the YouTube element</li>
</ul>
<pre><code class ="css">.container {
width: 100%;
max-width: 960px;
}
</code></pre>
</section>
<section>
<h3>Media Queries</h3>
<p class="left-align"><a href="https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries">Media Queries</a> apply CSS based on conditions that you decide (usually width, but can also be resolution, device size, height, media type).</p>
<pre><code class ="css">@media print {
* {
background: white !important;
}
}
</code></pre>
<pre><code class ="css">@media (min-width:600px) {
header {
/* styles for only 600px wide & up */
}
}
</code></pre>
</section>
<section>
<h3>Let's Develop It</h3>
<p class="left-align">Change your <em>header</em> element's background color so it's red at screen sizes larger than 600 pixels.</p>
<pre><code class ="css">header {
background: #0580C3;
}
@media (min-width:600px) {
header {
margin: 0 ??% 0 0;
width: ???%;
float: left;
}
}
</code></pre>
</section>
<section>
<h3>Hmm...</h3>
<p class="left-align">Where do you put your media queries??</p>
<ul>
<li>At the bottom of your stylesheet</li>
<li>After your mobile-first CSS but before your Print styles</li>
<li>After each element that needs a media query - you can have multiple media queries, even of the same type!</li>
<li><strong>For Mobile First sites, always after your default CSS!</strong></li>
<li>With min-width, in order by small to large values</li>
</ul>
</section>
<section>
<h3>Media Queries</h3>
<p class="left-align">Just like with a print stylesheet, you can add media queries based on screen size to any element you want:</p>
<ul>
<li><a href="http://codepen.io/bradfrost/full/orKvD" target="_blank">Widths</a></li>
<li>
<a href="http://codepen.io/bradfrost/full/vcuem">Floats</a></li>
<li><a href="http://www.weblinc.com/">Font size and style</a></li>
<li><a href="http://www.visitderby.co.uk/">Hovers</a></li>
<li><a href="http://2013.dconstruct.org/">Navigation</a></li>
<li><a href="http://www.julianabicycles.com/">Click/Tap Targets likes links and buttons</a></li>
<li><a href="http://codepen.io/bradfrost/full/orJwL">Content that you want to display or hide</a></li></li>
</ul>
</section>
<section>
<h3>Media Queries</h3>
<p>Most important elements to target with media queries are usually layout-related, like your fluid grid styles.</p>
<pre><code class ="css">.container {
margin: 0 auto;
width: 100%;
}
@media (min-width:960px) {
.container {
width: 960px;
}
}
</code></pre>
</section>
<section>
<h3>Fluid Grid Problem!</h3>
<p>Sometimes our fluid grids are too small to fit our content nicely in our design at small screen sizes:</p>
<img src="images/squishedgrid.png" alt="Squished grid is too squished">
</section>
<section>
<h3>Let's Develop It</h3>
<p class="left-align">Fix your squished grid callout styles:</p>
<ul>
<li>Move your .callout divs' width and float styles inside a media query</li>
<li>Fix styles as needed for your default CSS</li>
</ul>
<pre><code class ="css">.callout { width: 100%; }
@media (min-width:960px) {
.callout {
margin: 0 ??% 0 0;
width: ???%;
float: left;
}
}
</code></pre>
</section>
<section>
<h3>Callout Divs Stacked</h3>
<p class="left-align">Here's how our callout divs should look now, without floats or widths on the left, and with floats and widths on the right:</p>
<a href="images/callout_stacked_small.png"><img src="images/callout_stacked_small.png" width=250></a>
<a href="images/callout_floated_large.png"><img src="images/callout_floated_large.png" width=450 style="vertical-align:top"></a>
</section>
<section>
<h3>Media Queries</h3>
<p>Media queries can also use:</p>
<ul>
<li>em values instead of pixels</li>
<li>max-width</li>
<li>min AND max-width parameters</li>
<li>resolution parameters</li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries#Media_features" title="Media query options">many more</a></li>
</ul>
</section>
<section>
<h3>Media Queries with Ems</h3>
<p>Convert pixel values to ems with <a href="http://pxtoem.com/" title="Covert Pixels to Ems">pxtoem.com</a>
<pre><code class ="css">@media (min-width:60em) {
.container {
width: 100%;
max-width: 960px;
}
}
</code></pre>
</section>
<section>
<h3>Media Queries using Max-Width</h3>
<p>Use multiple parameters to target in-between sizes (aka breakpoints)</p>
<pre><code class ="css">@media (min-width:700px) and (max-width: 800px) {
.nav {
font-size: 110%;
}
}
</code></pre>
</section>
<section>
<h3>Let's Develop It</h3>
<p class="left-align">Make your <em>.content</em> div yellow between 700 and 800 pixels wide only, and green above 800 pixels</p>
<pre><code class ="css">@media (min-width:700px) and (max-width: 800px) {
.content {
background-color: green;
}
}
</code></pre>
</section>
<section>
<h3>Let's Develop It</h3>
<p class="left-align">Make a mobile-first responsive site:</p>
<ul>
<li>Move ALL your floats & widths into a media query for 960px wide viewports and up.</li>
<li>Add mobile first styles for your CSS that's not inside a media query: widths, padding, floats as needed, etc.</li>
<li>Resize browser to see your media queries kick in at the larger screen size.</li>
</ul>
</section>
<!-- Breakpoints -->
<section>
<h3>Breakpoints</h3>
<p class="left-align">The points in your layout where you add a media query, or where things shift and change.</p>
<pre><code class ="css">/* this is a 60em or 960px wide breakpoint */
@media (min-width:60em) {
.container {
width: 100%;
max-width: 960px;
}
}
</code></pre>
</section>
<section>
<h3>???</h3>
<p>How do you know what breakpoint you're looking at??</p>
<ul>
<li>Inspector and Dev Tools to the rescue!! Resize with your inspector open to see the viewport size in pixels</li>
<li class="left-align">Add the <a href="http://www.josscrowcroft.com/2011/code/window-size-bookmarklet/">Window Size bookmarklet</a> to your browser!</li>
</ul>
</section>
<section>
<h3>Breakpoints</h3>
<p class="left-align">These can be based on popular device sizes, like iPhone, iPad and desktop resolutions:</p>
<pre><code class ="css">.container { width: 100%; }
@media (min-width:320px) {
.container {
margin: 0 auto;
width: 320px;
}
}
@media (min-width: 768px) {
.container {
width: 768px;
}
}
@media (min-width: 960px) {
.container {
width: 960px;
}
}
</code></pre>
<p class="left">Example: <a href="http://www.eataly.com/">Eataly</a></p>
</section>
<section>
<h3>Breakpoints</h3>
<p class="left-align">Breakpoints can also be more fluid, and added only where the layout starts to look funky:</p>
<pre><code class ="css">.hero-image { width: 100%; }
@media (min-width:530px) {
.container {
float: left;
width: 41.6666666666667%; /* 400px/960px */;
}
}
</code></pre>
<p class="left-align">Example: <a href="http://bohconf.com/">BohConf</a></p>
</section>
<!-- Let's Develop It -->
<section>
<h3>Let's Develop It</h3>
<ul>
<li>Add media queries for breakpoints that are the size of popular mobile devices (phones, tablets, etc)</li>
<li>Look up these screen resolutions - try looking up your own devices</li>
<li>Try changing the widths at these breakpoints to mimic the rigid grid layouts we looked at.</li>
<!-- <li>Helpful tools:
<ul>
<li>
<a href="http://responsivepx.com/">Breakpoint Finder</a> - works on local sites (using localhost)
</li>
<li>
<a href="http://www.josscrowcroft.com/2011/code/window-size-bookmarklet/">Window Size Bookmarklet</a>
</li>
<li>
<a href="http://www.responsinator.com/">Responsinator</a> - mimics real device sizes
</li>
</ul>
</li> -->
</ul>
</section>
<!-- Goal -->
<section>
<h3>Goal #3</h3>
<div>
Optimize our site design for small screens and mobile devices.
</div>
</section>
<section>
<h1>Best Practices</h1>
</section>
<!-- Terms-->
<section>
<h3>Terms</h3>
<ul>
<li>
<div class = "blue">Best Practice</div>
<div>Method or technique that has consistently shown results superior to those achieved with other means, and that is used as a benchmark <a href="http://en.wikipedia.org/wiki/Best_practice">(Wikipedia)</a></div>
</li>
<li>
<div class = "blue">Design Pattern</div>
<div>Describe solutions to common usability or accessibility problems in a specific context<a href="http://en.wikipedia.org/wiki/Interaction_design_pattern">(Wikipedia)</a></div>
</li>
</ul>
</section>
<!-- W3C Best Practices for Mobile Web Design -->
<section>
<h3>Mobile Web Design</h3>
<p class="left-align"><a href="http://www.w3.org/TR/mobile-bp/#d0e630">Best practices recommended by the W3C</a>:</p>
<ul>
<li>User experience is consistent across devices</li>
<li>Flexible styling is used instead of fixed pixels</li>
<li>Relevant content is most prominent element on a page</li>
<li>Irrelevant content does not appear</li>
</ul>
</section>
<!-- W3C Best Practices for Mobile Web Design -->
<section>
<h3>Mobile Web Design</h3>
<p class="left-align"><span class="blue">User Experience:</span>
Ensure that content provided by accessing a URI yields a thematically coherent experience when accessed from different devices.
</p>
<img src="images/fifa_mobile.png" alt="" width=300>
<a href="http://m.jcrew.com"><img src="images/mobile_jcrew.png" alt="" width=300 style="vertical-align: top"></a>
</section>
<!-- W3C Best Practices for Mobile Web Design -->
<section>
<h3>Mobile Web Design</h3>
<p class="left-align"><span class="blue">Testing:</span>
Carry out testing on actual devices as well as emulators.
</p>
<img src="images/my_devices.jpg" alt="">
</section>
<!-- W3C Best Practices for Mobile Web Design -->
<section>
<h3>Mobile Web Design</h3>
<p class="left-align"><span class="blue">Content:</span>
Ensure that material that is central to the meaning of the page precedes material that is not.
</p>
<a href="images/content_first.png" title=""><img src="images/content_first.png" alt="" width=300></a>
<a href="images/grist_headline.png" title=""><img src="images/grist_headline.png" alt="" width=300></a>
</section>
<section>
<a href="https://twitter.com/wilto/status/63284673723375616" title='“Mobile users want to see our menu, hours, and delivery number. Desktop users definitely want this 1mb png of someone smiling at a salad.”'><img src="images/wilto.png" alt='“Mobile users want to see our menu, hours, and delivery number. Desktop users definitely want this 1mb png of someone smiling at a salad.”'></a>
</section>
<!-- Let's Develop It -->
<section>
<h3>Let's Develop It</h3>
<ul>
<li>Update our mobile-first CSS to make our content appear most prominent on the page</li>
<li>Change styles to make nagivation and header less prominent, and text content the main feature without user having to scroll. <a href="images/design_small_stacked.png">Design guideline</a></li>
<li>Use the <a href="http://www.josscrowcroft.com/2011/code/window-size-bookmarklet/">Window Size Bookmarklet</a> and <a href="index.html#/23">Dev Tools</a> to test your site on narrow screens and short screens
</li>
</ul>
<a href="images/design_small_stacked.png"><img src="images/design_small_stacked.png" alt="Design Guideline for narrow screens"></a>
</section>
<!-- W3C Navigation Best Practices for Mobile Web Design -->
<section>
<h3>Mobile Web Design</h3>
<p class="left-align"><a href="http://www.w3.org/TR/mobile-bp/#bpgroupnavlinks">Navigation Best practices recommended by the W3C</a>:</p>
<ul>
<li>
Provide only minimal navigation at the top of the page.
</li>
<li>
Provide consistent navigation mechanisms.
</li>
<li>
Clearly identify the target of each link (e.g. no use of "Click here").
</li>
</ul>
</section>
<section>
<h4>Provide only minimal navigation at the top of the page</h4>
<a href="images/all_nav.png" title=""><img src="images/all_nav.png" alt="" width=250></a>
<a href="images/texas_tribune.png" title=""><img src="images/texas_tribune.png" alt="" width=250></a>
<a href="images/lifehacker_nav.png" title=""><img src="images/lifehacker_nav.png" alt="" width=250></a>
</section>
<section>
<h4>Provide consistent navigation mechanisms</h4>
<a href="images/brooklyn_museum.png" title=""><img src="images/brooklyn_museum.png" alt="" width=250></a>
<a href="images/brooklyn_museum2.png" title=""><img src="images/brooklyn_museum2.png" alt="" width=250></a>
<a href="images/brooklyn_museum3.png" title=""><img src="images/brooklyn_museum3.png" alt="" width=250></a>
</section>
<section>
<h4>
Clearly identify the target of each link <br> (no "Click here").
</h4>
<a href="images/visitnow.png" title=""><img src="images/visitnow.png" alt="" width=350></a>
<a href="images/boingboing.png" title=""><img src="images/boingboing.png" alt="" width=350></a>
</section>
<!-- Navigation Patterns -->
<section>
<h3>Navigation Patterns</h3>
<div class="left-align">
<ul>
<li><a href="http://codepen.io/bradfrost/full/vcuem" title="">Stacked List</a></li>
<li><a href="http://codepen.io/bradfrost/full/Egaql">Nav bar</a></li>
<li><a href="http://codepen.io/bradfrost/full/hkuzA">Select menu</a></li>
<li><a href="http://codepen.io/bradfrost/full/sHvaz">Toggle</a></li>
<li><a href="http://codepen.io/bradfrost/full/IEBrz">Off Canvas</a></li>
</ul>
</div>
<cite><a href="http://bradfrostweb.com/blog/web/responsive-nav-patterns/">(Responsive Nav Patterns)</a></cite>
</section>
<!-- Navigation Patterns -->
<section>
<h3>Navigating for Touch Devices</h3>
<div class="left-align">
<ul>
<li>Apple minimum tap dimensions: 44x44pts</li>
<li>Windows Phone guideline dimensions: 32x32pts</li>
<li>User experience <a href="http://uxdesign.smashingmagazine.com/2012/02/21/finger-friendly-design-ideal-mobile-touchscreen-target-sizes/">research</a> suggests even larger dimensions for fingers/thumbs: 72x72px</li>
<li>Extra padding on links</li>
<li>Extra space around links</li>
</ul>
</div>
</section>
<section>
<h3>Touch-friendly Navigation</h3>
<blockquote class="quote">Your controls need to facilitate touch interaction. This might mean giving links in content body extra padding so they’re easier to tap. This might also mean you need to add extra space between items in an ordered list of links.</blockquote>
<cite><a href="http://www.uxbooth.com/articles/considerations-for-mobile-design-part-3-behavior/">(Considerations for Mobile Design [Part 3: Behavior])</a></cite>
</section>
<section>
<h3>Touch-friendly Links</h3>
<blockquote class="quote">Touchable items should look like touchable items on handheld devices.</blockquote>
<cite><a href="http://www.uxbooth.com/articles/considerations-for-mobile-design-part-3-behavior/">(Considerations for Mobile Design [Part 3: Behavior])</a></cite>
<p class="left-align" style="margin-top:2em">
Style nav links or callout links as buttons with borders, bolded text & background colors that stand out from other non-nagivation links and text.
</p>
</section>
<section>
<h3>Let's Develop It</h3>
<ul>
<li>Use navigation best practices to make your nav menu touch-friendly and usable at small screen sizes.</li>
<li>Use the <a href="#/27">"Nav Bar"</a> or <a href="#/27">"Stacked List"</a> design pattern to accomplish this for small screens.</li>
<li>Use media queries to change the nav bar to match our original design at larger screen sizes where it fits the layout best.</li>
</ul>
</section>
<!-- Goal -->
<section>
<h3>Goal #4</h3>
<div>
Make a responsive navigation menu that clicks to open on small screens.
</div>
</section>
<section>
<h3>Responsive Navigation</h3>
<ul>
<li>Provide only minimal navigation at the top of the page</li>
<li>
Provide consistent navigation mechanisms.
</li>
<li>Should be touch-friendly with large, tappable buttons</li>
</ul>
</section>
<section>
<h3>Responsive Navigation</h3>
<p class="left-align">How do we reconcile these requirements?</p>
<p class="left-align">
Build a <a href="http://codepen.io/bradfrost/full/sHvaz">toggle menu</a> that shows/hides our small screen nav on click/touch.
</p>
</section>
<section>
<h3>Writing JavaScript with jQuery</h3>
<ul>
<li><a href="http://jquery.com">jQuery</a> is a JavaScript framework</li>
<li>Learn more from <a href="https://github.com/girldevelopit/gdi-core-javascript">Girl Develop It materials</a></li>
<li>Easy to learn syntax and <strong>DOM</strong> manipulation</li>
</ul>
</p>
</section>
<!-- Exercise-->
<section>
<h3>Let's Develop It</h3>
<ul>
<li>Add jQuery to the bottom of your index.html file</li>
<li>Inspect or View Source in your browser to make sure it's loading</li>
</ul>
</section>
<section>
<h3>jQuery Toggle</h3>
<p class="left-align"><a href="http://api.jquery.com/toggle/">Toggle</a> refers to showing/hiding element</p>
<p class="left-align">
Syntax looks like:
</p>
<pre><code contenteditable class ="javascript">$('nav').toggle();</code></pre>
</section>
<section>
<h3>jQuery Toggle</h3>
<p class="left-align">
We want this toggle to show or hide our nav on <strong>alternate clicks</strong> so we put this toggle inside a <strong>click event</strong>:
</p>
<pre><code contenteditable class ="javascript">$('.button').click(function() {
$('nav').toggle();
});</code></pre>
</section>
<!-- Exercise-->
<section>
<h3>Let's Develop It</h3>
<ul>
<li>Add a button to your HTML (this will trigger the menu toggle!)</li>
<li>Add the toggle event code to your page underneath your jQuery include (~line 130), inside a <script> tag:</li>
</ul>
<pre><code contenteditable class ="javascript"><script>
$('.toggle-button').click(function() {
$('header nav').toggle();
});
</script></code></pre>
</section>
<section>
<h3>jQuery Toggle for Mobile Only</h3>
<p class="left-align">
This toggle button should only show at small screen sizes, so hide it with CSS inside a media query for large screen sizes:
</p>