forked from girldevelopit/gdi-featured-html-css-intermediate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
executable file
·2167 lines (1945 loc) · 72.1 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>Intermediate HTML/CSS & Intro to Responsive Design ♥ Girl Develop It</title>
<meta name="description" content="">
<meta name="author" content="Cara Jo Miller, Marcy Sutton, Thomas Wilburn">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="stylesheet" href="reveal/css/reveal.css">
<link rel="stylesheet" href="reveal/css/theme/simple.css" id="theme">
<!-- For syntax highlighting -->
<!-- light editor-->
<link rel="stylesheet" href="css/styles/tomorrow.css">
<link rel="stylesheet" href="css/slides.css">
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if (window.location.search.match(/print-pdf/gi)) {
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'reveal/css/print/pdf.css';
document.getElementsByTagName('head')[0].appendChild(link);
}
</script>
<link rel="icon" type="image/x-icon" href="reveal/favicon.ico" />
<!--[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 -->
<section>
<img src="images/gdi_logo_badge.png" style="padding: 10px; width:400px;" alt="gdi" />
<h3>Intermediate HTML/CSS & Intro to Responsive Design</h3>
</section>
<section>
<h3>Class notes</h3>
<p>All slides are available at <a href="http://gdiseattle.github.io/gdi-featured-intermediate-html-css">
http://gdiseattle.github.io/gdi-featured-intermediate-html-css</a>
</p>
<p>The slide repository is also available on Github at <a href="https://github.com/gdiseattle/gdi-featured-intermediate-html-css">
http://github.com/gdiseattle/gdi-featured-intermediate-html-css</a>
</p>
</section>
<!-- Welcome-->
<section class="hide-pdf">
<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 class="hide-pdf">
<h3>About your instructor</h3>
<div>
<h4>Thomas Wilburn</h4>
<ul>
<li>News Developer at The Seattle Times</li>
<li>Author of Caret, an open-source text editor</li>
<li>B-boy, Urban Artistry DC</li>
<li>Twitter: <a href="http://twitter.com/thomaswilburn">@thomaswilburn</a>
</li>
<li>E-mail: <a href="mailto:[email protected]">[email protected]</a>
</li>
</ul>
</div>
</section>
<section>
<h3>Thank you to our Teaching Assistants today</h3>
</section>
<section>
<h3>Now it's all about you!</h3>
<ul>
<li>Tell us who you are.</li>
<li>What do you hope to get out of this class?</li>
<li>If you could have any kind of animal as a pet, what would it be?</li>
</ul>
</section>
<section>
<h2>What we'll be covering in this class</h2>
<p>We'll be jumping into HTML/CSS right where the beginner class left off.</p>
<p>We will not be going over the previous class, there's too much cool stuff to learn!</p>
</section>
<section>
<h3>We will be building a profile site from scratch</h3>
<img src="images/portfolio-site.png" alt="today's project" style="max-height: 500px" />
</section>
<section class="interstitial">
<h1>Workshop files</h1>
</section>
<section>
<h3>Workshop files</h3>
<p>Last reminder to download the files for today's class!
<a href="http://gdiseattle.github.io/gdi-featured-intermediate-html-css/workshop-files.zip" target="blank">
http://gdiseattle.github.io/gdi-featured-intermediate-html-css/workshop-files.zip</a>
</p>
<ul>
<li>We have provided a folder that contains sample images for you to use today. We encourage you to be creative so don't feel like you're restricted to these images</li>
<li>We've also included a blank index.html file for you to work from, as well as the final site for you to use as a reference if you get stuck.</li>
</ul>
</section>
<section>
<h3>Folder Structure</h3>
<p>We've set up the folder structure for the site today to reflect common practices used.</p>
<img src="images/folder-structure.png" alt="folder structure" style="max-height: 450px;" />
</section>
<section>
<h3>Cheat sheets</h3>
<p>We've provided a copy of the site you'll be building today with notes on how to break down the layout of the page.</p>
</section>
<section class="interstitial">
<h1>Common Applications</h1>
</section>
<section>
<h3>Common Applications</h3>
<p>HTML & CSS are awesome, right?</p>
<p>But how do people use them
<span class="green">really?</span>
<p>Here's a few things we'll be covering today:</p>
<ul>
<li class="fragment">Horizontal & fixed navigation</li>
<li class="fragment">Heros with full bleed background images</li>
<li class="fragment">Border-radius on images & elements</li>
<li class="fragment">Custom font-faces</li>
<li class="fragment">Three column layouts</li>
<li class="fragment">Fancy buttons</li>
</ul>
</section>
<section class="interstitial">
<h1>Standard Practices</h1>
</section>
<section>
<h3>Standard Practices</h3>
<ul>
<li class="fragment">Reset CSS files</li>
<li class="fragment">Standard widths and sizes</li>
<li class="fragment">Containers for layout</li>
</ul>
</section>
<section>
<h3>Reset CSS</h3>
<p>Even though HTML is the structure and CSS is the design, some HTML elements have default styles</p>
<p>Different browsers display these things differently. A reset gets rid of these inconsistencies.</p>
<p class="fragment">
<strong>Examples include:</strong>
</p>
<ul class="fragment">
<li>Bulleted lists like this one have standard bullets</li>
<li>Paragraphs & headings have default padding</li>
<li>Links are blue and underlined</li>
</ul>
</section>
<section>
<h3>Reset CSS</h3>
<div>
Most elements:
<pre><code class="css">
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
</code></pre>
</div>
<div>
Lists:
<pre><code class="css">
list-style-type: square;
</code></pre>
</div>
</section>
<section>
<h3>Box model</h3>
<p>We're also going to adjust the box model from "padding-box" (the default) to "border-box"</p>
<pre><code class="css">
* {
box-sizing: border-box;
}
</code></pre>
</section>
<section>
<h3>Padding box</h3>
<p>The standard HTML box model is "padding-box." In this model, padding is added to the width of a box.
<pre><code class="css">
/* On the page, this element is 550px wide:
500px width + 25px left padding + 25px right padding */
.element {
box-sizing: padding-box; /* default */
width: 500px;
padding: 25px;
}
</code></pre>
</section>
<section>
<h3>Border box</h3>
<p>The "border-box" model works more the way we tend to think about elements: padding is applied after the width is set, not before.</p>
<pre><code class="css">
/* This element actually is 500px wide */
.element {
box-sizing: border-box;
width: 500px;
padding: 25px;
}
</code></pre>
</section>
<section>
<h3>Why box model matters</h3>
<p>By using <code>border-box</code>, it's easier to fit elements neatly into a space, because we can add up the widths in percentages, regardless of padding.</p>
<pre><code class="css">
* { box-sizing: border-box }
.sidebar {
float: left;
width: 33%;
padding: 8px;
}
.mainbar {
float: left;
width: 67%;
padding: 16px;
}
</code></pre>
</section>
<section>
<h3>Reset CSS</h3>
<p>We've done all the hard work for you! Instead of typing this out - we've included this in our example files.</p>
</section>
<section>
<h3>Standard widths and sizes</h3>
<ul>
<li>Screen sizes vary from computer to computer. Standardize your site on different screen sizes by defining specific widths.</li>
<li>Wrap your content in containers to control the max width it can span across a screen.</li>
<li>Keep in mind screen sizes also mean different font size display.</li>
<li>Retina screens have a higher pixel density and a larger resolution, so fonts appear smaller.</li>
</ul>
</section>
<section>
<h3>Fluid layouts</h3>
<ul>
<li>Also referred to as a liquid layout.</li>
<li>Majority of the components, including the wrapper, have percentages for their widths.</li>
<li>The layout adjusts for the width of the user's screen resolution.</li>
<li>Some elements may have pixel-based minimum or maximum widths.</li>
<li>Ties into responsive layouts, which we'll cover in more detail later.</li>
</ul>
</section>
<section>
<h3>Containers</h3>
<p>Wrappers are a good way to center content if the screen width is wider than your content.</p>
<pre><code class="css">
.container {
width: 100%; /* take up full viewport width */
max-width: 1400px; /* if viewport is larger than 1440px,
don't let it take up 100% */
margin: 0 auto; /* center content in the viewport */
}
</code></pre>
<ol>
<li>The container will take up 100% of the screen if the width of the viewport is less than 1440px.</li>
<li>If the viewport is wider than 1440px, it will reach it's max width, and become centered in the viewport.</li>
</ol>
</section>
<section class="interstitial">
<h1>HTML5</h1>
</section>
<section>
<h3>HTML5: What is it?</h3>
<p>Formally, HTML5 is the <a href="http://www.w3.org/TR/html5/" target="_blank">W3C’s specification</a> for the newest version of HTML.</p>
<p>Informally, people use "HTML5" to refer to a whole set of new web standards and abilities:
<ul class>
<li>HTML5</li>
<li>CSS3</li>
<li>JavaScript</li>
</ul>
</section>
<!-- Specifications-->
<section>
<h2>Quick History of HTML5</h2>
<ul>
<li>
<strong class="blue">2004:</strong>WHAT-WG Working group formed. (Web Hypertext Application Technology Working Group)
<br/>
<p>Members from Apple, Mozilla, & Opera set out to develop HTML5.
</li>
<li class="fragment">
<strong class="blue">2008:</strong>First verson of HTML5 published
<p>First draft is written, but changes are still coming. HTML5 is continually evolving.</p>
</li>
<li class="fragment">
<strong class="blue">2008:</strong>Firefox 3 becomes HTML5 compatible.
</li>
<li class="fragment">
<strong class="blue">Jan. 2010:</strong>YouTube now offers HTML5 video player.
</li>
</ul>
</section>
<section>
<h2>Okay, not that quick history of HTML5</h2>
<ul>
<li class="fragment">
<strong class="blue">April 2010:</strong> Steve jobs trashes Flash & bans it on all Apple devices in favor of HTML5.
</li>
<li class="fragment">
<strong class="blue">Dec. 2010:</strong> Chrome opens HTML5 web store.
</li>
<li class="fragment">
<strong class="blue">Sept. 2011:</strong> 34% of top 100 sites use HTML5
</li>
<li class="fragment">
<strong class="blue">Sept. 2012:</strong> WC3 proposes stable release of HTML5 by end of 2014
</li>
</ul>
</section>
<!-- Browser compatibility-->
<section>
<h2>What about the browsers?</h2>
<p>Percentage of HTML5 Elements supported:</p>
<ul>
<li class="chrome">
<strong>Chrome 35:</strong>
<span class="green">92% supported</span>
</li>
<li class="opera">
<strong>Opera 22:</strong>
<span class="blue">90% supported</span>
</li>
<li class="firefox">
<strong>Firefox 30:</strong>
<span class="blue">84% supported</span>
</li>
<li class="webkit">
<strong>Safari 7:</strong>
<span class="blue">72% supported</span>
</li>
<li class="ie">
<strong>Internet Explorer 11:</strong>
<span class="blue">68% supported</span>
</li>
</ul>
</section>
<section>
<h3>So what's so cool about it?</h3>
<img src="images/html5.svg" style="width:25%" alt="HTML 5" class="no-border" />
<p>Too much to cover in our time together</p>
<p>But here are some highlights:</p>
</section>
<section>
<h2>Marks some old things obsolete</h2>
<h4>Examples</h4>
<ul>
<li>Deprecated items (e.g.
<code>frame, frameset, noframes</code>)
</li>
<li>Presentational elements and attributes replaced by CSS (e.g.
<code>font, big, center</code>)
</li>
</ul>
<a href="http://dev.w3.org/html5/spec/single-page.html#obsolete">Reference</a>
</section>
<section>
<h2>Redefines a few things</h2>
<p>Gives some old elements semantic meaning and separates them from presentation (e.g.
<code>b, i, strong, em</code>)</p>
</section>
<!-- DOCTYPE -->
<section>
<h2>HTML5 Doctype</h2>
<pre><code class="html">
<!DOCTYPE html>
</code></pre>
<p>
Minimum information required to ensure that a browser renders using standards mode
</p>
</section>
<section>
<h2>Old Doctypes</h2>
<pre><code class="html">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
</code></pre>
</section>
<!-- New Elements -->
<section>
<h2>New Structural Elements</h2>
</section>
<section>
<h2><section></h2>
<ul>
<li>Group together thematically related content</li>
<li>Similar to prior use of the div, but div has no semantic meaning</li>
</ul>
</section>
<section>
<h2><header></h2>
<ul>
<li>Container for a group of introductory or navigational aids</li>
<li>Document can have multiple header elements</li>
<li>E.g. One for the page, one for each section</li>
<li>Page header can be identified by screen readers with <code>role="banner"</code></li>
</ul>
</section>
<section>
<h2><nav></h2>
<ul>
<li>Contains major navigational information</li>
<li>Usually a list of links</li>
<li>Often lives in the header</li>
<li>E.g. site navigation</li>
</ul>
</section>
<section>
<h2><footer></h2>
<ul>
<li>Contains information about its containing element</li>
<li>E.g. who wrote it, copyright, links to related content, etc.</li>
<li>Document can have multiple footer elements</li>
<li>E.g. One for the page, one for each section</li>
<li>Page footer can be identified by screen readers with <code>role="contentinfo"</code></li>
</ul>
</section>
<section>
<h2><aside></h2>
<ul>
<li>Tangentially related content</li>
<li>E.g. sidebar, pull quotes</li>
</ul>
</section>
<section>
<h2><article></h2>
<ul>
<li>Self-contained related content</li>
<li>E.g. blog posts, news stories, comments, reviews, forum posts</li>
</ul>
</section>
<section>
<h2><main></h2>
<ul>
<li>Semantic container for main content</li>
<li>Only one instance per page allowed, with <a href="http://html5doctor.com/the-main-element/" title="HTML5 Doctor Main element documentation">
some other restrictions</a></li>
<li>Provides a landmark for screen reader users</li>
</ul>
</section>
<section>
<h3>Let's Develop It</h3>
<ul>
<li>Use new semantic HTML5 elements to layout the site</li>
<li>Refer to the example design for hints.</li>
</ul>
</section>
<section class="interstitial">
<h1>Horizontal Fixed Nav</h1>
</section>
<section>
<h3>All the cool kids are doing it these days</h3>
<ul>
<li>Horizontal fixed-to-top nav allows users to have access to navigational elements at all times.</li>
<li>All the rage these days</li>
<li>Be careful - screen heights vary, and it reduces the amount of content visible on smaller screens.</li>
</ul>
</section>
<section>
<h3>Review: relative position</h3>
<img src="./images/relative.svg" alt="Diagram of relative positioning">
<p>Relative position places an element based on its normal position</p>
</section>
<section>
<h3>Review: absolute position</h3>
<img src="./images/absolute.svg" alt="Diagram of absolute positioning">
<p>Absolute position places an element based on the nearest ancestor element with non-static position, and removes it from layout</p>
</section>
<section>
<h3>Review: fixed position</h3>
<img src="./images/fixed.svg" alt="Diagram of fixed positioning">
<p>Fixed position places an element based on the window viewport, and removes it from layout (it is "sticky" despite scrolling)
</section>
<section>
<h3>Fixed Nav: HTML</h3>
<pre><code class="html">
<nav>
<ul>
<li><a href="#home">My Home</a></li>
<li><a href="#diet">My Diet</a></li>
<li><a href="#pattern">Stripes</a></li>
</ul>
</nav>
</code></pre>
</section>
<section>
<h3>Fixed Nav: CSS</h3>
<p>Remember, using fixed position is like using absolute position, except that it's fixed to the viewport, not the containing element.</p>
<p>We also have to define a width for it, and its location.</p>
<pre><code class="css">
nav {
position: fixed;
top: 0;
left: 0;
width: 100%;
background: rgba(250, 250, 250, 0.8);
border-bottom: 2px solid #ccc;
overflow: hidden;
height: 70px;
}
</code></pre>
</section>
<section>
<h3>Fixed Nav: CSS</h3>
<p>Because we've fixed the nav to the top of the viewport, we need to bump the content of the
<code>body</code> down to be visible to the user.</p>
<p>This should be the same, or more than, the height of the navigation bar.</p>
<pre><code class="css">
body {
padding-top: 70px;
}
nav {
position: fixed;
top: 0;
left: 0;
width: 100%;
background: rgba(250, 250, 250, 0.8);
border-bottom: 2px solid #ccc;
overflow: hidden;
height: 70px;
}
</code></pre>
</section>
<section>
<h3>Fixed Nav: CSS</h3>
<p>Now we need to get those list items next to each other instead of stacked.</p>
<p>Let's float them to the left and add some padding to the links so they have a large clickable area.</p>
<pre><code class="css">
nav li {
float: left;
}
nav li a {
padding: 25px 10px;
display: block;
text-decoration: none;
color: #333;
}
</code></pre>
</section>
<section>
<h3>Fixed Nav: Adding a brand</h3>
<p>We can use a single
<code>H1</code> with text replacement to include a brand, or logo, in the corner
that will still work if images are turned off, making it accessible to screen readers.</p>
<pre><code class="html">
<nav>
<h1 class="brand">IMA Zebra</h1>
<ul>
<li><a href="#home">My Home</a></li>
<li><a href="#diet">My Diet</a></li>
<li><a href="#pattern">Stripes</a></li>
</ul>
</nav>
</code></pre>
</section>
<section>
<h3>Fixed Nav: <br>Text Replacement & H1s</h3>
<p>(<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/background">CSS Background Reference</a>)</p>
<pre><code class="css">
.brand {
text-indent: -9000px;
background: url(../images/z.png) no-repeat top left;
background-size: 45px;
height: 45px;
width: 45px;
float: left;
margin: 10px;
}
.main-nav ul {
float: right;
}
</code></pre>
<p>The background url must match an image in your workshop files. Remember relative URLs?</p>
</section>
<section>
<h3>Why Text Replacement?</h3>
<ul>
<li>Use a background image in an accessible way.</li>
<li>If we turn the CSS off for this page, the title will still be visible to the browser.</li>
<li>If a user is coming to our site with a screen reader, the title of the site will be readable to them.</li>
<li>Search engines ♥ it!</li>
</ul>
</section>
<section>
<h3>Fixed Nav: Container</h3>
<p>Notice how the edge of the nav bumps up against the edge of the browser? Let's fix that by adding a container around it.</p>
<pre><code class="html">
<nav>
<div class="container">
<h1 class="brand">IMA Zebra</h1>
<ul>
<li><a href="#home">My Home</a></li>
<li><a href="#diet">My Diet</a></li>
<li><a href="#pattern">Stripes</a></li>
</ul>
</div>
</nav>
</code></pre>
</section>
<section>
<h3>Fixed Nav: Container</h3>
<p>Let's give the container a fixed width and see what happens.</p>
<pre><code class="css">
.container {
width: 1024px;
margin: 0 auto;
}
</code></pre>
<p>Now wherever we use
<code>.container</code> it will be 1024px wide and centered.</p>
</section>
<section>
<h3>Develop It!</h3>
<p>Let's make some small tweaks to the navigation
<ul>
<li>Remove the underlines on the links with
<code>text-decoration</code>
</li>
<li>Change the color of the links</li>
<li>Try adding a background color on hover and focus</li>
</ul>
</section>
<section class="interstitial">
<h2>Hero Section</h2>
</section>
<section>
<h3>What is a Hero?</h3>
<ul>
<li>Large banner image, prominently placed on a web page, generally front and center</li>
<li>First visual a visitor encounters on the site and its purpose is to present an overview of the site's most important content</li>
<li>Often consists of image and text, can be static or dynamic</li>
</ul>
</section>
<section>
<section>
<h2>Hero Examples</h2>
</section>
<section>
<img src="images/apple.png" alt="Apple.com" class="plain" />
</section>
<section>
<img src="images/uber.png" alt="Uber.com" class="plain" />
</section>
<section>
<img src="images/fostr.png" alt="Fostr" class="plain" />
</section>
<section>
<img src="images/ndesign.png" alt="nDesign" class="plain" />
</section>
<section>
<img src="images/karma.png" alt="Karma" class="plain" />
</section>
</section>
<section>
<h3>Hero: HTML</h3>
<p>Our hero section should look a little something like this:</p>
<pre><code class="html">
<header class="hero">
<img src="images/zebra.jpg" alt="Zebra">
<h2>I.M.A. Zebra</h2>
<span class="subhead">Not a horse</span>
</header>
</code></pre>
</section>
<section>
<h3>Hero: CSS</h3>
<p>Now is where the fun really happens!</p>
<pre><code class="css">
.hero {
background: url(../images/zebra-hero.jpg) no-repeat 50% 50%;
text-align: center;
color: #fafafa;
padding: 50px 0;
}
</code></pre>
</section>
<section>
<h3>Well, that was unexpected...</h3>
<p>Things that are wrong with this hero right now:
<ol>
<li>That profile image is way to big! And it's not even a circle!</li>
<li>The background image is way too large</li>
<li>The headline is really tiny</li>
</ol>
</section>
<section>
<h3>Hero: Profile Image</h3>
<p>Let's make the profile image a little smaller.</p>
<p>We'll use CSS Targeting with the descendant selector to style the image.</p>
<pre><code class="css">
.hero img {
width: 150px;
}
</code></pre>
<p>That should do it</p>
</section>
<section class="interstitial">
<h1>Border Magic</h1>
</section>
<section>
<h3>Turning squares into circles with magic!</h3>
<p>Okay, it's not really magic, it's just a bit of CSS3.</p>
</section>
<section>
<h3>Border-Radius</h3>
<p>Simply put, allows you to create rounded corners on boxes.</p>
<p>Designers rejoice!</p>
</section>
<section>
<h3>Border-radius</h3>
<p>20px radius on all corners</p>
<pre><code class="css">
.hero img {
border-radius: 20px;
}
</code></pre>
<img src="images/radius-20.png" alt="" />
</section>
<section>
<h3>Border-radius</h3>
<p>10px radius on top left & bottom right</p>
<p>40px on top right & bottom left</p>
<pre><code class="css">
.hero img {
border-radius: 10px 40px;
}
</code></pre>
<img src="images/radius-10-40.png" alt="" />
</section>
<section>
<h3>Border-radius</h3>
<p>10px radius on top left</p>
<p>20px radius top right</p>
<p>40px radius bottom right</p>
<p>80px radius bottom left</p>
<pre><code class="css">
.hero img {
border-radius: 10px 20px 40px 80px;
}
</code></pre>
<img src="images/radius-10-20-40-80.png" alt="" />
</section>
<section>
<h3>Border-radius</h3>
<p>50% radius on all corners</p>
<pre><code class="css">
.hero img {
border-radius: 50%;
}
</code></pre>
<img src="images/radius-50.png" alt="" />
</section>
<section class="interstitial">
<h1>Back to our Hero!</h1>
</section>
<section>
<h3>Background-size</h3>
<p>Notice how the image is too large for the section? Let's fix that with a new property called
<br><code>background-size</code> (<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/background-size">Reference</a>)
</p>
<pre><code class="css">
.hero {
background: url(../images/zebra-hero.jpg) no-repeat 50% 50%;
text-align: center;
color: #fafafa;
background-size: cover;
padding: 50px 0;
}
</code></pre>
<p>
<code>background-size: cover;</code> scales the image to the largest size such that both its width and its height can fit inside the content area.</p>
</section>
<section>
<h3>Borders & currentColor</h3>
<ul>
<li>Borders can inherit color from the <code>color</code> property.</li>
<li><code>currentColor</code> is a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#currentColor_keyword">keyword</a> for the calculated value of that color property.</li>
<li>Great for inheriting colors!</li>
</ul>
<pre><code class="css">
.hero p {
border: 1px solid;
color: blue;
}
.hero p span {
background: currentColor;
}
</pre></code>
<p><a href="http://simurai.com/blog/2014/05/04/cssconf/#color" target="_blank">Example</a></p>
</section>
<section>
<h2>Font Sizes</h2>
<p>Setting up a web typography scale could be a whole class by itself. But here is a resource:</p>
<p><a href="http://typecast.com/blog/a-more-modern-scale-for-web-typography">A Modern Scale for Web Typography</a></p>
</section>
<section>
<h3>Develop It!</h3>
<p>Let's make some small tweaks to the Hero</p>
<ul>
<li>Use <code>border-radius</code> to make the hero profile image into a circle.</li>
<li>Adjust the font size of the header.</li>
<li>Add a border to the span.</li>
</ul>
</section>
<section class="interstitial">
<h1>3-column Content Area</h1>
</section>
<section>
<h3>3 Column: HTML</h3>
<p>Our code should look something like this:</p>
<pre><code class="html">
<main class="main-content">
<h3>I'm a zebra.</h3>
<section class="column" id="home">
<img src="images/africa.png" alt="Africa">
<h4>My Home</h4>
<p>Wild zebras live in Africa.</p>
<a href="" class="btn">See my home</a>
</section>
<!-- repeat with two more sections -->
</main>
</code></pre>
</section>
<section>
<h3>3 Column: CSS</h3>
<p>Now that we have our 3 columns, we want them to appear next to each other. We can do this by floating them all left.</p>
<pre><code class="css">
.column {
float: left;
width: 33.33%;
padding: 15px;
}
</code></pre>
<p>We used 33.33%, because it let's us perfectly spaced columns without doing math! Don't forget padding to give the columns so space.</p>
</section>
<section>
<h3>Wow. Large Images.</h3>
<p>The images didn't scale with the columns, because they ignore constraints like
<code>div</code> width, unless you tell it to do so.</p>
<pre><code class="css">
.column img {
width: 90%;
display: block;
margin: auto;
}
</code></pre>
<p>There we go!</p>
<p>Let's add a border radius to it too, because we ♥ circles</p>
<pre><code class="css">
.column img {
width: 90%;
display: block;
margin: auto;
border-radius: 50%;
}
</code></pre>
</section>
<section>
<h3>3 Column: Container</h3>
<p>We've got our 3 column layout set, our images are scaled based on the width of the
column, but our columns are still bumping against the edges of the browser.</p>
<pre><code class="html">
<main class="main-content container">
<h3>I'm a zebra.</h3>
<section class="column"></section>
<section class="column"></section>
<section class="column"></section>
</main>
</code></pre>
<p>Adding the container class makes the everything line up.</p>
</section>
<section>
<h2>Clearing floats</h2>
<ul>
<li>So that elements coming after our floats don't overlap, we need a
clearing element, sometimes called a "clearfix".</li>
<li>Any element can be used to clear floats using <code>clear: both;</code>.</li>
<li>To be extra crafty and efficient, try using it on a pseudo-element:</li>
</ul>
<pre><code class="css">
.main-content::after {
content: '';
clear: both;
display: block;
}
</pre></code>
<p><a href="https://css-tricks.com/the-how-and-why-of-clearing-floats/" target="_blank">
More about float clearing</a></p>