forked from girldevelopit/gdi-featured-html-css-intro
-
Notifications
You must be signed in to change notification settings - Fork 2
/
class3.html
821 lines (773 loc) · 29.8 KB
/
class3.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Girl Develop It - Intro to HTML + CSS, Class 3</title>
<meta name="description" content="Girl Develop It's Intro to HTML and CSS course, customized by Liz Shaw">
<meta name="author" content="Liz Shaw">
<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="css/reveal.css">
<link rel="stylesheet" href="css/theme/simple.css" id="theme">
<!-- For syntax highlighting -->
<!-- light editor<link rel="stylesheet" href="lib/css/light.css">-->
<!-- dark editor-->
<link rel="stylesheet" href="lib/css/dark.css">
<link rel="stylesheet" href="lib/css/zenburn.css">
<link rel="stylesheet" href="plugin/accessibility-helper/css/accessibility-helper.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 = 'css/print/pdf.css';
document.getElementsByTagName('head')[0].appendChild(link);
}
</script>
<!-- If use the PDF print sheet so students can print slides-->
<link rel="stylesheet" href="css/print/pdf.css" type="text/css" media="print">
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<div class="slides">
<!-- Code Your Own Website -->
<section>
<h2>Code Your Own Website</h2>
<img src="img/circle-gdi-logo.png" alt="GDI Logo" />
<h3>Intro to HTML + CSS</h3>
<p>
<small>Class 3</small>
</p>
</section>
<!-- Recapping -->
<section>
<h3>Recap</h3>
<p class="blue">A quick file path exercise</p>
<pre class="fragment"><code class="html">
<!doctype html>
<html>
<head>
<link href="pointB.css" rel="stylesheet" />
</head>
<body>
</body>
</html>
</code></pre>
<p class="fragment"><br />The <span class="green">rel</span> attribute stands for <span class="green">relationship</span>, since it specifies the relationship between the current document (<span class="orange">the HTML</span>) and the linked document/resource (<span class="orange">the CSS</span>)</p>
</section>
<section>
<h3>Recap</h3>
<p>
<a href="/gdi-intro-html-css/in-class-exercises/class3/pointA.html" target="_blank">A quick file path exercise »</a>
</p>
<table class="data compact">
<tr>
<th>File Path</th>
<th>What it means</th>
</tr>
<tr>
<td>
<link href="<span class="blue">pointB.css</span>" rel="stylesheet" />
</td>
<td>
pointB.css is located in the current folder
</td>
</tr>
<tr>
<td>
<link href="<span class="blue">css/pointB.css</span>" rel="stylesheet" />
</td>
<td>
pointB.css is located in a folder called <span class="green">css</span>. The <span class="green">css</span> folder is located in the current folder.
</td>
</tr>
<tr>
<td>
<link href="<span class="blue">css/other/pointB.css</span>" rel="stylesheet" />
</td>
<td>
pointB.css is located in a folder called <span class="green">other</span> that is located in a folder called <span class="green">css</span> that is located in the current folder.
</td>
</tr>
<tr>
<td>
<link href="<span class="blue">../pointB.css</span>" rel="stylesheet" />
</td>
<td>
pointB.css is located in a folder one level up from the current folder
</td>
</tr>
<tr>
<td>
<link href="<span class="blue">../../pointB.css</span>" rel="stylesheet" />
</td>
<td>
pointB.css is located in a folder two levels up from the current folder
</td>
</tr>
</table>
<p><br /><small>A <span class="green">folder</span> is also called a <span class="green">directory</span></small></p>
</section>
<!-- Our Class Project -->
<section>
<h3>What We'll Be Coding Today</h3>
<img src="img/design.png" alt="Design - before and after" style="max-height: 60vh;">
<p><small>
<a href="img/design.png" target="_blank">View design image »</a><br />
<a href="img/project.psd">Download PSD (optional; requires Photoshop) »</a>
</small></p>
</section>
<!-- Let's Develop It! -->
<section>
<h3>Get Started: Folder Structure</h3>
<div>
<div class="left" style="width:50%;">
<p class="left-align">Go ahead and create your folders</p>
<p class="left-align">Ignore the HTML and CSS files for now</p>
</div>
<div class="right">
<img src="img/folderstructure-project.png" alt="The project folder structure" />
</div>
</div>
</section>
<section>
<h3>Get Started: Images</h3>
<img src="img/folderstructure-project-images.png" alt="The project folder structure" />
<ol>
<li>Go to <a href="http://tinyurl.com/gdiboston">http://tinyurl.com/gdiboston</a> to download images.zip<!--http://anything.codes/gdi-intro-html-css/images.zip--></li>
<li>Open images.zip<ul><li>If you're using Windows, 'Extract' images.zip</li></ul></li>
<li>Place the unzipped images in the 'project/images' folder you just created</li>
</ol>
</section>
<section>
<h3>Get Started: Files</h3>
<ol>
<li>Open your text editor and create a new file.</li>
<li>Save it as index.html in the 'project' folder you created earlier.</li>
<li>Add the fundamental structure (a doctype, head, title and body).</li>
<li>Create a new file in your text editor. Save it as styles.css in the 'project/css' folder you created earlier.</li>
</ol>
<img src="img/folderstructure-project.png" alt="Folder Structure" />
</section>
<section data-background="#f05b62">
<h1 style="color: #fafafa;">What now?</h1>
</section>
<!-- The display Property -->
<section>
<h3>The <em>display</em> Property</h3>
<p class="blue">Inline vs. Block</p>
<pre><code class="css">
selector {
display: inline;
display: block;
}
</code></pre>
</section>
<section>
<h3>The <em>display</em> Property</h3>
<p class="blue">Inline vs. Block</p>
<div>
<div class="left" style="width: 50%; text-align: left;">
<div class="fragment">
<p>So far, we have mostly seen <span class="green">"block"</span> elements</p>
<p>They appear on the next line, like paragraphs</p>
</div>
<br><br>
<div class="fragment">
<p>There are also <span class="green">"inline"</span> elements</p>
<p>They appear on the same line that they are written on</p>
</div>
</div>
<div class="right fragment">
<img src="img/blockinline.png" alt="example of inline and block elements">
</div>
</div>
</section>
<section>
<h3>The <em>display</em> Property</h3>
<p class="blue">Inline vs. Block</p>
<p data-height="268" data-theme-id="0" data-slug-hash="RWjLrR" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/RWjLrR/'>Inline vs. Block</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
<p><span class="green">Block elements</span> push sibling elements to another line. <span class="green">Inline elements</span> allow sibling elements to sit to their right and left.</p>
<p class="blue fragment"><small>Click 'Edit on CodePen' to edit the above code.<br />(Don't worry, your changes can't overwrite anything!)</small></p>
</section>
<!-- Important Display Differences -->
<section>
<h3>Important Differences</h3>
<p class="blue">Inline vs. Block</p>
<table class="data">
<tr>
<th></th>
<th>Inline</th>
<th>Block</th>
<!--<th>Inline-Block</th>-->
</tr>
<!--<tr>
<td>Respect left and right margins</td>
<td><span class="green">✔</span></td>
<td><span class="green">✔</span></td>
<td><span class="green">✔</span></td>
</tr>
<tr>
<td>Respect top and bottom margins</td>
<td><span style="color:red">✗</span></td>
<td><span class="green">✔</span></td>
<td><span class="green">✔</span></td>
</tr>-->
<tr>
<td>Can have a set width and height</td>
<td><span style="color:red">✗</span></td>
<td><span class="green">✔</span></td>
<!--<td><span class="green">✔</span></td>-->
</tr>
<tr>
<td>Allow other elements to their left and right</td>
<td><span class="green">✔</span></td>
<td><span style="color:red">✗</span></td>
<!--<td><span class="green">✔</span></td>-->
</tr>
<tr>
<td>Force sibling elements to move to a new line</td>
<td><span style="color:red">✗</span></td>
<td><span class="green">✔</span></td>
<!--<td><span style="color:red">✗</span></td>-->
</tr>
</table>
<!--<p>If it's a rectangle, it's a 'block' element.</p>-->
</section>
<!-- Other inline and block elements -->
<section>
<h3>Default Display Values</h3>
<p>HTML elements have default <span class="green">display</span> values that the browser uses</p>
<ul>
<li class="fragment"><span class="orange">Inline Elements:</span>
<ul>
<li class="fragment"><span></li>
<li class="fragment"><em> and <strong></li>
<li class="fragment"><a></li>
<li class="fragment"><img></li>
</ul>
<br />
</li>
<li class="fragment"><span class="orange">Block Elements:</span>
<ul>
<li class="fragment"><div></li>
<li class="fragment"><p></li>
<li class="fragment"><h1>, <h2>, <h3>, <h4>, and <h6></li>
<li class="fragment">... and almost everything else!</li>
</ul>
</li>
</ul>
</section>
<!-- The span Element -->
<section>
<h3>Inline Elements</h3>
<p class="blue">Example: <span></p>
<ul>
<li class="fragment"><span> is an <span class="green">inline</span> element: Each new span is rendered next to each other and only wraps when it reaches the edge of the container element</li>
<li class="fragment">Can be used to apply styles to text inline so as not to break the flow of content</li>
</ul>
<div class="fragment">
<p data-height="268" data-theme-id="0" data-slug-hash="rOYYex" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/rOYYex/'>Inline Element</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
</section>
<!-- The div Element -->
<section>
<h3>Block Elements</h3>
<p class="blue">Example: <div></p>
<ul>
<li class="fragment">The <div> is a <span class="green">block</span> element</li>
<li class="fragment">It pushes sibling elements to another line</li>
</ul>
<div class="fragment">
<p data-height="268" data-theme-id="0" data-slug-hash="WQXXwW" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/WQXXwW/'>Block Element</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
<p><a href="http://codepen.io/anythingcodes/pen/PPEaKW?editors=110" target="_blank">Forcing a block-level div's 'display' property to 'inline' »</a></p>
</div>
</section>
<!-- Grouping Elements with div -->
<section>
<h3>Grouping Elements with <div>s</h3>
<ul>
<li class="fragment">The <div> element can also be used to group similarly-styled elements together</li>
<li class="fragment"><span class="green">For example:</span> What if we want the first 2 paragraphs of a section to be right-aligned, purple, and bold, but we don't want any other paragraphs to be right-aligned?
<ul>
<li class="fragment">We would wrap them in a <div> element to style them differently</li>
<li class="fragment"><a href="http://codepen.io/anythingcodes/pen/ojoGQY?editors=110" target="_blank">Example (before) »</a></li>
<li class="fragment"><a href="http://codepen.io/anythingcodes/pen/GpyGMj?editors=110" target="_blank">Example (after) »</a></li>
</ul>
</li>
</ul>
</section>
<!-- Block-Level Elements -->
<section>
<h3>Block-Level Elements in Layouts</h3>
<p>Block-level elements are used to divide or section content within an HTML page</p>
<p class="fragment">
<img src="img/divided-page.jpg" alt="A page divided up into sections" />
</p>
</section>
<section>
<h3>Block-Level Elements in Layouts</h3>
<p class="fragment">Group other elements within dividing elements to format them differently with CSS</p>
<div class="fragment">
<p data-height="268" data-theme-id="0" data-slug-hash="xwPXYG" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/xwPXYG/'>Layouts & Sections</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
</section>
<section>
<h3>Block-Level Elements in Layouts</h3>
<p class="blue">Common Examples:</p>
<div>
<div class="left">
<ul>
<li><div></li>
<li><section></li>
<li><nav></li>
<li><main></li>
<li><aside></li>
<li><article></li>
<li><header></li>
<li><footer></li>
</ul>
</div>
<div class="right">
<p>
<img src="img/divided-page.jpg" alt="A page divided up into sections" />
</p>
</div>
</div>
</section>
<!-- Let's Develop It! -->
<section>
<h2>Let's Develop It!</h2>
<p>Let's create block-level elements to separate content into different sections on our page</p>
<p><br /><small>
<a href="img/design.png" target="_blank">View design image »</a><br />
<a href="img/project.psd">Download PSD (optional; requires Photoshop) »</a>
</small></p>
</section>
<!-- Pseudoclasses for Links -->
<section>
<h3>Pseudoclasses for Links</h3>
<p>Changing the format of a link when you hover over it is accomplished by using <span class="green">pseudoclasses</span></p>
<pre><code class="html">
selector:pseudoclass {
property: value;
}
</code></pre>
<p class="fragment">CSS pseudoclasses are used to add special effects to some selectors</p>
<pre class="fragment"><code class="html">
a:hover {
color: #F0C042;
}
</code></pre>
</section>
<!--<section>
<h3>Pseudoclasses for Links</h3>
<pre><code class="html">
a:hover {
color: #F0C042;
}
a:active {
color: orange;
}
a:visited {
color: purple;
}
</code></pre>
<p><br /><small><span class="green">Note:</span> a:active <strong>must</strong> come after a:hover in the CSS definition in order to be effective!</small></p>
<p data-height="268" data-theme-id="0" data-slug-hash="Vvryeq" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/Vvryeq/'>Pseudoclasses for Links</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
<p class="blue fragment"><small>Click 'Edit on CodePen' to edit the above code.<br />(Don't worry, your changes can't overwrite anything!)</small></p>
</section>-->
<!-- Let's Develop It! -->
<section>
<h2>Let's Develop It!</h2>
<p>Let's add a default link color and hover color to your links. Let's also add a font-family style to the body.</p>
</section>
<!-- CSS Box Model -->
<section>
<h3>CSS Box Model</h3>
<p>
<img src="img/box-model.png" alt="The Box Model" />
</p>
</section>
<!--<section>
<h3>CSS Box Model</h3>
<p><span class="blue">Padding:</span> Space between the border and the content</p>
<p>
<img src="img/box-model.png" alt="The Box Model" />
</p>
</section>-->
<section>
<h3>CSS Box Model</h3>
<p class="blue">A Practical Example</p>
<p>
<img src="img/box-model-example.png" alt="A box example" />
</p>
</section>
<!-- Padding -->
<section>
<h3>Padding</h3>
<ul>
<li>Space between the border and the content</li>
<li>Adds to the total width of the box</li>
<li>Same background color as the content</li>
</ul>
<p>
<img src="img/box-model.png" alt="The Box Model" />
</p>
</section>
<section>
<h3>Padding</h3>
<div class="fragment">
<p>15 pixels on all sides:</p>
<pre><code class="css">
selector {
padding: 15px;
}</code></pre>
</div>
<div class="fragment">
<p>25 pixels on top only:</p>
<pre><code class="css">
selector {
padding-top: 25px;
}</code></pre>
</div>
</section>
<section>
<h3>Padding</h3>
<div class="fragment">
<p>Four values:</p>
<pre><code class="css">
selector {
padding: top right bottom left;
}
</code></pre>
</div>
<div class="fragment">
<p>Two values:</p>
<pre><code class="css">
selector {
padding: topAndBottom leftAndRight;
}
</code></pre>
</div>
<div class="fragment">
<p>One value:</p>
<pre><code class="css">
selector {
padding: all;
}
</code></pre>
</div>
</section>
<section>
<h3>Padding</h3>
<p class="blue">A Mnemonic for Four Values</p>
<div class="fragment">
<p>10px on top, 5px on right, 3px on bottom, 15px on left:</p>
<pre><code class="css">
div {
padding: 10px 5px 3px 15px;
}</code></pre>
<p>
<img src="img/trouble.gif" alt="Trouble Shorthand" />
</p>
<p>It's also <span class="green">clockwise</span>!</p>
</div>
</section>
<section>
<h3>Padding</h3>
<p data-height="268" data-theme-id="0" data-slug-hash="YyEEvj" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/YyEEvj/'>Padding</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</section>
<!-- Border -->
<section>
<h3>Border</h3>
<ul>
<li>The edge around the box, specified as "thickness, style, color"</li>
</ul>
<p>
<img src="img/box-model.png" alt="The Box Model" />
</p>
</section>
<section>
<h3>Border</h3>
<p class="blue">Properties</p>
<div class="fragment">
<p>You can specify each property separately:</p>
<pre><code class="css">
selector {
border-width: 10px;
border-style: dashed;
border-color: grey;
}
</code></pre>
</div>
<div class="fragment">
<p>Or with all three together:</p>
<pre><code class="css">
selector {
border: 10px dashed grey;
}
</code></pre>
</div>
</section>
<section>
<h3>Border</h3>
<div class="fragment">
<p>A solid red border:</p>
<pre><code class="css">
selector {
border: 1px solid red;
}
</code></pre>
</div>
<div class="fragment">
<p>A thick dotted black top border:</p>
<pre><code class="css">
selector {
border: 4px dotted black;
}
</code></pre>
</div>
<div class="fragment">
<p>Two different border styles:</p>
<pre><code class="css">
selector {
border-top: 1px solid green;
border-bottom: 4px dashed purple;
}
</code></pre>
</div>
</section>
<section>
<h3>Border</h3>
<p data-height="268" data-theme-id="0" data-slug-hash="jbaaeP" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/jbaaeP/'>Border</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</section>
<!-- Margin -->
<section>
<h3>Margin</h3>
<ul>
<li>The transparent area around the box that separates it from other elements</li>
</ul>
<p>
<img src="img/box-model.png" alt="The Box Model" />
</p>
</section>
<section>
<h3>Margin</h3>
<div class="fragment">
<p>15 pixels on all sides:</p>
<pre><code class="css">
selector {
margin: 15px;
}</code></pre>
</div>
<div class="fragment">
<p>25 pixels on top only:</p>
<pre><code class="css">
selector {
margin-top: 25px;
}</code></pre>
</div>
</section>
<section>
<h3>Margin</h3>
<div class="fragment">
<p>Four values:</p>
<pre><code class="css">
selector {
margin: top right bottom left;
}
</code></pre>
</div>
<div class="fragment">
<p>Two values:</p>
<pre><code class="css">
selector {
margin: topAndBottom leftAndRight;
}
</code></pre>
</div>
<div class="fragment">
<p>One value:</p>
<pre><code class="css">
selector {
margin: all;
}
</code></pre>
</div>
</section>
<section>
<h3>Margin</h3>
<p class="blue">A Mnemonic for Four Values</p>
<p class="fragment green"><small>The same mnemonic!</small></p>
<div class="fragment">
<p>10px on top, 5px on right, 3px on bottom, 15px on left:</p>
<pre><code class="css">
div {
margin: 10px 5px 3px 15px;
}</code></pre>
<p>
<img src="img/trouble.gif" alt="Trouble Shorthand" />
</p>
<p>It's also <span class="green">clockwise</span>!</p>
</div>
</section>
<section>
<h3>Margin</h3>
<p data-height="400" data-theme-id="0" data-slug-hash="yYPPQJ" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/yYPPQJ/'>Margin</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</section>
<!-- Let's Develop It! -->
<section>
<h2>Let's Develop It!</h2>
<p>Let's add some padding, margins, and a border to the <h3>s in our project</p>
</section>
<!-- Auto Margin -->
<section>
<h3>Auto Margin</h3>
<p>If a margin is set to <span class="orange">auto</span> on a box that has width, the margins will take up as much space as possible</p>
<div class="fragment">
<p class="blue">Centered</p>
<pre><code class="css">
selector {
margin: auto;
width: 300px;
}
</code></pre>
</div>
<!--<div class="fragment">
<p class="blue">Flush Right</p>
<pre><code class="css">
selector {
margin-left: auto;
margin-right: 5px;
width: 300px;
}
</code></pre>
</div>-->
</section>
<!-- Property: width -->
<section>
<h3>Property: <em>width</em></h3>
<p>Sets the width of an element</p>
<p class="fragment">Does not include padding or borders, since those add to the width</p>
<p class="fragment"><span class="green">Remember:</span> <u class="fragment"> block </u> elements respect width, while <u class="fragment"> inline </u> elements do not</p>
</section>
<!-- Let's Develop It! -->
<section>
<h2>Let's Develop It!</h2>
<p>Let's center our <h3>s and <section>s</p>
</section>
<!-- Property: height -->
<section>
<h3>Property: <em>height</em></h3>
<p>Sets the height of an element</p>
<p class="fragment">Does not include padding or borders, since those add to the height</p>
<p class="fragment"><span class="green">Remember:</span> <u class="fragment"> block </u> elements respect height, while <u class="fragment"> inline </u> elements do not</p>
</section>
<!-- Important Display Differences -->
<section>
<h3>Important Differences: Part 2</h3>
<p class="blue">Inline vs. Block</p>
<table class="data">
<tr>
<th></th>
<th>Inline</th>
<th>Block</th>
<!--<th>Inline-Block</th>-->
</tr>
<tr>
<td>Respect left and right margins</td>
<td><span class="green">✔</span></td>
<td><span class="green">✔</span></td>
<!--<td><span class="green">✔</span></td>-->
</tr>
<tr>
<td>Respect top and bottom margins</td>
<td><span style="color:red">✗</span></td>
<td><span class="green">✔</span></td>
<!--<td><span class="green">✔</span></td>-->
</tr>
</table>
<p class="fragment"><small>Inline elements respect top and bottom padding, but it is relative to the baseline.</small></p>
<!--<p>If it's a rectangle, it's a 'block' element.</p>-->
</section>
<!-- Next Week -->
<section>
<h2>Next Week</h2>
<p class="blue">CSS Positioning, Flow, & Other<br />Coding Goodness</p>
</section>
<section>
<h3>Questions?</h3>
<div style="font-size:1200%; height:100%; margin-top:20%" class="blue">?
<div class="clear"></div>
</div>
<aside class="notes">Can always email me!</aside>
</section>
</div>
<footer>
<div class="copyright">
Intro to HTML & CSS | Boston Chapter |
<a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/deed.en_US"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/3.0/80x15.png" />
</a>
</div>
</footer>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [{
src: 'lib/js/classList.js',
condition: function() {
return !document.body.classList;
}
}, {
src: 'plugin/markdown/marked.js',
condition: function() {
return !!document.querySelector('[data-markdown]');
}
}, {
src: 'plugin/markdown/markdown.js',
condition: function() {
return !!document.querySelector('[data-markdown]');
}
}, {
src: 'plugin/highlight/highlight.js',
async: true,
condition: function() {
return !!document.querySelector('pre code');
},
callback: function() {
hljs.initHighlightingOnLoad();
}
}, {
src: 'plugin/zoom-js/zoom.js',
async: true
}, {
src: 'plugin/notes/notes.js',
async: true
}, {
src: 'plugin/accessibility-helper/js/accessibility-helper.js',
async: true,
condition: function() {
return !!document.body.classList;
}
}]
});
</script>
<script async src="//assets.codepen.io/assets/embed/ei.js"></script>
</body>
</html>