forked from girldevelopit/gdi-featured-html-css-intro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
class3.html
525 lines (465 loc) · 17.6 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Class 3 ~ HTML/CSS ~ Girl Develop It</title>
<meta name="description" content="This is curriculum for the GDI RDU intro to web series. It was developed from the official Girl Develop It Core HTML/CSS curriculum">
<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 rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/simple.css" id="theme">
<link rel="stylesheet" href="css/custom.css">
<!-- 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">
<section>
<img src="img/circle-gdi-logo.png" alt="GDI Logo" class="noborder">
<h1>Intro to HTML/CSS</h1>
<h2>Class 3</h2>
</section>
<!-- Quiz 1-->
<section>
<h3>Quiz Part 1</h3>
<p>Within your <html></html> tags, which are the two nested tags required for a website?</p>
<div class="fragment">
<pre><code class="html xml"><html>
<head>
</head>
<body>
</body>
</html>
</code></pre>
</div>
</section>
<!-- Quiz 2-->
<section>
<h3>Quiz Part 2</h3>
<p class="fragment visible">What does a complete paragraph element look like?</p>
<div class="fragment">
<pre><code class="html xml"><p>This is a paragraph</p>
</code></pre>
</div>
</section>
<!-- Quiz 3-->
<section>
<h3>Quiz Part 3</h3>
<p class="fragment">What does a complete link (anchor) element look like? Hint: needs an 'href'.</p>
<div class="fragment">
<pre><code class="html xml"><a href="http://google.com/">This goes to google</a>
</code></pre>
</div>
</section>
<!-- Inline vs. block-->
<section>
<h3>Inline vs Block</h3>
<div class="halfblock">
<p>So far, we have mostly seen <strong>"block"</strong> elements. They appear on the next line, like paragraphs.</p>
<p>There are also <strong>"inline"</strong> elements. They appear on the same line that they are written on.</p>
</div>
<div class="halfblock">
<img src="img/example-blockinline.png" alt="example of inline and block elements" />
</div>
<div class="clear"></div>
</section>
<section>
<h3>Block & Inline Elements</h3>
<ul>
<li>CSS divides HTML into two types: inline and block.</li>
<li>After block elements, browsers render a new line.</li>
<li><strong>Inline elements:</strong> img, a, br, em, strong</li>
<li><strong>Block elements:</strong> p, h1, ul, li, almost everything else</li>
</ul>
</section>
<!-- Divs -->
<section>
<h3>Element: Div</h3>
<ul>
<li>Block level element. Each new div is rendered on a new line.</li>
<li>A division, or section of content within an HTML page.</li>
<li>Used to group elements to format them with CSS.</li>
<li>Apply IDs and Classes to divs to control their styles with CSS.</li>
</ul>
</section>
<section>
<h3>Div Examples</h3>
<pre><code class="html"><div>
<p>Content<p>
<p>Content<p>
</div>
</code></pre>
<pre><code class="html"><div id="header">
<h1>Main Heading<h1>
</div>
</code></pre>
<pre><code class="html"><div class="sub-content">
<p>Some more content<p>
</div>
</code></pre>
</section>
<section>
<h3>Grouping elements with div</h3>
<ul>
<li>The div tag is used everywhere to group elements together into sections.</li>
<li>You can wrap groups of elements in a div to style them differently.</li>
</ul>
</section>
<section>
<h3>Grouping elements with div, cont.</h3>
<pre><code class="css">.align-right{
text-align:right;
color: purple;
font-weight: bold;
}
</code></pre>
<pre><code class="html"><div class="align-right">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>
<p>Sed do eiusmod tempor incididunt ut labore et dolore.</p>
</div>
<p>Magna aliqua. Ut enim ad minim veniam.</p>
<p>Quis nostrud exercitation ullamco.</p>
</code></pre>
<div style="text-align:right; font-weight:bold; font-size:70%; color:purple;">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>
<p>Sed do eiusmod tempor incididunt ut labore et dolore.</p>
</div>
<div style="font-size:70%;">
<p>Magna aliqua. Ut enim ad minim veniam.</p>
<p>Quis nostrud exercitation ullamco.</p>
</div>
</section>
<section>
<h3>HTML5</h3>
<p class="left-align">HTML5 offers new elements for better document structure and semantics</p>
<p class="left-align">Some of the most commonly used new tags include:</p>
<pre><code class ="html"><header></header>
<nav></nav>
<article></article>
<section></section>
<main></main>
<footer></footer>
</code></pre>
<p>A full list can be found <a href="http://www.tutorialspoint.com/html5/html5_new_tags.htm">here</a>.</p>
</section>
<section>
<h3>Let's Develop It</h3>
<p>Let's create a site using divs to separate content into different sections on our page.</p>
<p>Create a header, content area, sidebar, and a footer.</p>
</section>
<section>
<h3>Sample Code</h3>
<p>A page divided into divs might look like this:</p>
<pre><code class="html"><!doctype html>
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<div id="header">
<h1>My Page Title</h1>
</div>
<div id="content">
<p>The main content</p>
</div>
<div id="sidebar">
<p>Some stuff in a sidebar</p>
</div>
<div id="footer">
<p>Copyright me</p>
</div>
</body>
</html>
</code></pre>
</section>
<section>
<h3>Sample Code: HTML5</h3>
<p>A page divided using HTML 5 elements might look like this:</p>
<pre><code class="html"><!doctype html>
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<header>
<h1>My Page Title</h1>
</header>
<main>
<p>The main content</p>
</main>
<aside>
<p>Some stuff in a sidebar</p>
</aside>
<footer>
<p>Copyright me</p>
</footer>
</body>
</html>
</code></pre>
</section>
<!-- Span -->
<section>
<h3>Element: Span</h3>
<ul>
<li>Inline element. Each new span is rendered next to each other & only wraps when it reaches the edge of the containing element.</li>
<li>Can be used to apply styles to text inline so as not to break the flow of content.</li>
</ul>
</section>
<section>
<h3>Span</h3>
<p>Span is used to apply a specific style inline</p>
<pre><code class="css">.highlight{
color:teal;
}
</code></pre>
<pre><code class="html"><p>Paragraph with <span class="highlight">teal</span> text.</p>
</code></pre>
<p>Paragraph with <span style="color:teal;">teal</span> text.</p>
</section>
<!-- Exercise-->
<section>
<h3>Let's Develop It</h3>
<p>Let's add some spans to our content to help highlight some text. </p>
</section>
<!-- Pseudo class-->
<section>
<h3>Pseudo-classess</h3>
<div class="halfblock">
<p>Changing the format of a link when you hover over it is accomplished by using pseudo-classes.</p>
<p>CSS pseudo-classes are used to add special effects to some selectors.</p>
</div>
<div class="halfblock">
<p>Syntax:</p>
<pre><code class="css">selector:pseudo-class{
property:value;
}
</code></pre>
<p>Example:</p>
<pre><code class="css">a:link{
text-decoration: none;
}
</code></pre>
</div>
</section>
<!-- Pseudo class-->
<section>
<h3>Pseudo-classes</h3>
<pre><code class="css">a:link {color:#FF0000;} /* unvisited link */
a:visited {color:#00FF00;} /* visited link */
a:hover, a:focus {color:#FF00FF;} /* mouse over or select with keyboard*/
a:active {color:#0000FF;} /* selected link */
</code></pre>
<p>a:hover <strong>MUST</strong> come after a:link and a:visited in the CSS definition to be effective!</p>
<p>a:active <strong>MUST</strong> come after a:hover in the CSS definition to be effective!</p>
</section>
<!-- Exercise-->
<section>
<h3>Let's Develop It</h3>
<p>Add pseudo classes to your links</p>
</section>
<!-- Box model-->
<section>
<h3>The Box Model</h3>
<img src="img/boxpadding.jpg" alt="Small box surrounded by packing peanuts in a larger box"/>
<p class="credit">Photo credit: <a href="http://www.flickr.com/photos/dchallender/76537016/">dchallender</a> <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/">cc</a>
</section>
<section>
<h3>Box Model</h3>
<img src="img/box-model.png" alt="Graphic illustrating box model"/>
</section>
<!-- Padding -->
<section>
<h3>Padding</h3>
<p>Space between the border and the content</p>
<img src="img/box-model-padding.png" alt="Graphic illustrating box model, padding highlighted"/>
</section>
<section>
<h3>Padding</h3>
<p>Notice that the padding adds to the total width of the box.</p>
<img src="img/box-model-padding.png" alt="Graphic illustrating box model, padding highlighted"/>
</section>
<section>
<h3>Padding</h3>
<p>15 pixels on all sides</p>
<pre><code class="css">padding: 15px;</code></pre>
<p>10 pixels on top only</p>
<pre><code class="css">padding-top: 10px;</code></pre>
<p>10 on top, 5 on right, 3 on bottom, 5 on left</p>
<pre><code class="css">padding: 10px 5px 3px 5px;</code></pre>
</section>
<section>
<h3>Padding</h3>
<p>Four values<p>
<pre><code class="css">padding: top right bottom left;</code></pre>
<p>Two values</p>
<pre><code class="css">padding: top/bottom right/left;</code></pre>
<p>One value</p>
<pre><code class="css">padding: all;</code></pre>
</section>
<section>
<h3>Padding</h3>
<pre><code class="css">padding: 10px 20px 30px 40px;</code></pre>
<img src="img/box-model-padding2.png" alt="Graphic illustrating box model, with uneven padding"/>
</section>
<!-- Border-->
<section>
<h3>Border</h3>
<p>The edge around the box.</p>
<img src="img/box-model-border.png" alt="Graphic illustrating box model, border highlighted">
</section>
<section>
<h3>Border</h3>
<p>Borders are specified as "thickness, style, color."</p>
<p>A solid red border</p>
<pre><code class="css">border: 1px solid #ff0000;</code></pre>
<p>A thick dotted black top border</p>
<pre><code class="css">border-top: 4px dotted #000000;</code></pre>
<p>Two different border styles</p>
<pre><code class="css">border-top: 1px solid #ff0000;
border-bottom: 4px dotted #000000;
</code></pre>
</section>
<section>
<h3>Border - Other Properties</h3>
<pre><code class="css">border-width: 10px;
border-style: dashed;
border-color: #666666;
</code></pre>
<p>You can specify each property separately, or all three together.</p>
</section>
<!-- Margin -->
<section>
<h3>Margin</h3>
<p>The transparent area around the box that separates it from other elements.</p>
<img src="img/box-model-margin.png" alt="Graphic illustrating box model, margin highlighted"/>
</section>
<section>
<h3>Margin</h3>
<p>15 pixels on all sides</p>
<pre><code class="css">margin: 15px;</code></pre>
<p>10 on top, 5 on right, 3 on bottom, 5 on left</p>
<pre><code class="css">margin: 10px 5px 3px 5px;</code></pre>
<p>10 pixels on top</p>
<pre><code class="css">margin-top: 10px;</code></pre>
</section>
<section>
<h3>Auto Margin</h3>
<p>If a margin is set to auto on a box that has width, it will take up as much space as possible.</p>
<p>CENTERED</p>
<pre><code class="css">margin: auto;
width: 300px;
</code></pre>
<p>FLUSH-RIGHT</p>
<pre><code class="css">margin-left: auto;
margin-right: 5px;
width: 300px;
</code></pre>
</section>
<section>
<h3>Wrappers</h3>
<p>Wrappers are a good way to center content if the screen width is wider than your content.</p>
<pre><code class="css">div.wrapper{
width: 100%;
max-width: 1400px;
margin: 0 auto;
}
</code></pre>
</section>
<!-- Exercise -->
<section>
<h3>Let's Develop it!</h3>
<p>Let's add some padding, borders, and margins to our divs.</p>
<p>Let's center our entire document in the browser.</p>
</section>
<!-- Sizing -->
<!-- Width-->
<section>
<h3>Property: Width</h3>
<p>Sets the width of an element.</p>
<p>Does not include padding or borders. Remember to add these to the width.</p>
<pre><code class="css">div#sidebar{
width: 31%;
padding: 1%;
border: none; //Total width is 33%
}
</code></pre>
</section>
<!-- height-->
<section>
<h3>Property: Height</h3>
<p>Sets the height of an element.</p>
<p>Does not include padding or borders. Remember to add these to the height.</p>
<pre><code class="css">p.alert{
height: 50px;
padding: 5px;
border: 2px solid red; //Total height is 64px
}
</code></pre>
</section>
<!-- Exercise -->
<section>
<h3>Let's develop it!</h3>
<div>
<p>Add a width & height to our divs.</p>
<p>Use IDs to target each div with CSS</p>
</div>
</section>
<section>
<h2>Questions?</h2>
</section>
</div><!-- Close slides -->
<div>
<footer>
<div class="copyright">
HTML/CSS ~ Girl Develop It
<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>
</div><!-- Closes Reveal -->
<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>
</body>
</html>