forked from girldevelopit/gdi-featured-html-css-intro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
class2.html
574 lines (522 loc) · 19.2 KB
/
class2.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Class 2 ~ 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 2</h2>
</section>
<!-- Quiz 1-->
<section>
<h3>Quiz Part 1</h3>
<p>Which tag is used to create a link to another page?</p>
<ol>
<li><p></li>
<li><link></li>
<li><a></li>
<li><america></li>
</ol>
<div class="fragment blue">Answer: <a></div>
</section>
<!-- Quiz 2-->
<section>
<h3>Quiz Part 2</h3>
<p>What are the two tags that nest directly within the <html> tags?</p>
<div class="fragment blue">Answer: <head> and <body></div>
</section>
<!-- Quiz 3-->
<section>
<h3>Quiz Part 3</h3>
<p>What is it called when you have a 'tag' + 'content' + 'closing tag'?</p>
<div class="fragment blue">Answer: An HTML <strong>Element</strong></div>
</section>
<!-- Review: Role of HTML v. CSS-->
<section>
<h3>Let's Review</h3>
<img src="img/elephants.jpg" alt="Two elephants interacting"/>
<p><small>Photo credit: <a href="http://www.flickr.com/photos/ginable/325235488/">Ginable</a> <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/">cc</a></small></p>
</section>
<section>
<h3>Anatomy of a website</h3>
<p><strong>Your Content</strong><br />
<strong>+ HTML</strong>: Structure<br />
<strong>+ CSS</strong>: Presentation<br />
<strong>= Your Website</strong></p>
<p>A website is a way to present your content to the world, using HTML and CSS to present that content & make it look good.</p>
</section>
<!-- What is CSS-->
<section>
<h3>CSS: What is it?</h3>
<p>CSS = <strong>C</strong>ascading <strong>S</strong>tyle <strong>S</strong>heets</p>
<p>CSS is a "style sheet language" that lets you style the elements on your page.</p>
<p>CSS is works in conjunction with HTML, but is not HTML itself.</p>
</section>
<section>
<h3>CSS: What can it do?</h3>
<p>All colored text, position, and size</p>
<img src = "img/homepage-view.png" alt="Screenshot of homepage">
</section>
<section>
<h3>CSS: What does it look like?</h3>
<img src = "img/homepage-css.png" alt="Screenshot of CSS">
</section>
<!-- The CSS Rule-->
<section>
<h3>The CSS Rule</h3>
<img src="img/cssrule.png" alt="The CSS Rule" style="border: none; box-shadow: none;"/>
</section>
<section>
<h3>The CSS Rule</h3>
<pre><code class = "css">selector {
property: value;
}
</code></pre>
<ul>
<li>A block of CSS code is a rule.</li>
<li>The rule starts with a selector.</li>
<li>It has sets of properties and values.</li>
<li>A property-value pair is a declaration.</li>
</ul>
</section>
<!-- Connecting HTML to CSS-->
<section>
<h3>Connecting CSS to HTML</h3>
<p class = "green">3 ways</p>
<p>"Inline"</p>
<p>"Embedded"</p>
<p>"External"</p>
</section>
<!-- Inline -->
<section>
<h3>Connecting CSS to HTML: Inline</h3>
<pre><code class = "html"><p style="color:red">Some text.</p>
</code></pre>
<p>Uses the HTML attribute style.</p>
<p>Difficult to use in large projects</p>
<p>Not preferred.</p>
</section>
<!-- Embedded -->
<section>
<h3>Connecting CSS to HTML: Embedded</h3>
<pre><code class = "html"><head>
<style type="text/css">
p {
color: blue;
font-size: 12px;
}
</style>
</head>
</code></pre>
<p>Inside <head> element.</p>
<p>Uses <style> tag.</p>
<p>Can only be used in one html file</p>
</section>
<!-- External-->
<section>
<h3>Connecting CSS to HTML: Linked</h3>
<pre><code class = "html"><head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
</code></pre>
<ul>
<li>Shared resource for several pages.</li>
<li>Reduced file size & bandwidth</li>
<li>Easy to maintain in larger projects.</li>
<li>Preferred by nerds everywhere!</li>
</ul>
</section>
<!-- Exercise-->
<section>
<h3>Let's develop it</h3>
<ul>
<li>In the same foolder you used last week, create a new file called style.css</li>
<li>Add a link to the file in the head of your HTML file</li>
<li>Add the CSS rule below to the CSS file:</li>
</ul>
<pre><code class = "css">body {
background-color: yellow;
}
</code></pre>
</section>
<!-- CSS Syntax -->
<section>
<h3>CSS Syntax</h3>
<p>Declarations: Property and value of style you plan to use on HTML element. </p>
<p>Declarations end with a semicolon</p>
<p>Declaration groups are surrounded by curly brackets.</p>
<pre><code class="css">selector {
property: value;
property: value;
property: value;
}
</code></pre>
</section>
<!-- Selectors elements-->
<section>
<h3>Selector: Element</h3>
<pre><code class="css">p {
property: value;
}
</code></pre>
<p>Selects all paragraph elements.</p>
<pre><code class="css">img {
property: value;
}
</code></pre>
<p>Selects all image elements.</p>
</section>
<!-- Color -->
<section>
<h3>CSS Color Values</h3>
<p>Your browser can accept colors in many different ways:</p>
<ul>
<li><strong>Color name</strong> (ex. red)</li>
<li><strong>Hexadecimal value</strong> (ex. #FF0000)</li>
<li><strong>RGB value</strong> (ex. rgb(255, 0, 0))</li>
<li><strong>HSL value</strong> (ex. hsl(0, 100%, 100%))</li>
</ul>
<p>
The 17 standard colors are:
<span style="color:aqua; background:black;">aqua</span>,
<span style="color:black,">black</span>,
<span style="color:blue;">blue</span>,
<span style="color:fuchsia;">fuchsia</span>,
<span style="color:gray;">gray</span>,
<span style="color:grey;">grey</span>,
<span style="color:green;">green</span>,
<span style="color:lime;">lime</span>,
<span style="color:maroon;">maroon</span>,
<span style="color:navy;">navy</span>,
<span style="color:olive;">olive</span>,
<span style="color:purple;">purple</span>,
<span style="color:red;">red</span>,
<span style="color:silver; background:black;">silver</span>,
<span style="color:teal;">teal</span>,
<span style="color:white; background:black;">white</span>,
and <span style="color:yellow; background:black;">yellow</span>.
</p>
</section>
<section>
<h3>Property: Color</h3>
<p>The color property changes the color of the text.</p>
<pre><code class = "css">p {
color: red;
color: #ff0000;
color: rgb(255, 0, 0);
}
</code></pre>
</section>
<!-- Background color-->
<section>
<h3>Property: Background-color</h3>
<p>The background-color property changes the color of the background.</p>
<pre><code class = "css">p {
background-color: black;
background-color: #000000;
background-color: rgb(0,0,0);
}
</code></pre>
</section>
<!-- Exercise-->
<section>
<h3>Let's develop it</h3>
<ul>
<li>Add some rules to your css file</li>
<li>Change the font color and background color of different types of elements</li>
<li>Try selecting links, paragraphs, and lists</li>
</ul>
</section>
<!-- Multiple values -->
<section>
<h3>Property Values</h3>
<p>Each property can have one or more comma separated values.</p>
<pre><code class = "css">p{
color: white;
background-color: red;
font-family: Arial, sans-serif;
}
</code></pre>
</section>
<!-- Fonts-->
<section>
<h3>Property: Font-family</h3>
<p>The font-family property defines which font is used.</p>
<pre><code class = "css">p {
font-family: "Times New Roman";
font-family: serif;
font-family: "Arial", sans-serif;
}
</code></pre>
<p>Specific font name</p>
<p>Generic name</p>
<p>Comma-separated list</p>
</section>
<!-- Font size -->
<section>
<h3>Property: Font-size</h3>
<p>The font-size property specifies the size of the font.</p>
<pre><code class = "css">p {
font-size: 12px;
font-size: 1.5em;
font-size: 100%;
}
</code></pre>
<p>Pixels</p>
<p>"em"</p>
<p>Percentage</p>
</section>
<!-- Fonts-->
<section>
<h3>Property: Fonts (shorthand)</h3>
<pre><code class = "css">p {
font-style: italic;
font-weight: bold;
font-size: 10px;
font-family: sans-serif;
}
</code></pre>
OR
<pre><code class = "css">p {
font: italic bold 10px sans-serif;
}
</code></pre>
</section>
<!-- Exercise-->
<section>
<h3>Let's develop it</h3>
<ul>
<li>Change the fonts of your page</li>
<li>Try changing the font sizes and styles for different elements</li>
</ul>
</section>
<!-- Selector position-->
<section>
<h3>Selector: Position</h3>
<pre><code class = "css">p em {
color: yellow;
}
</code></pre>
<p>Selects all em elements that are within a paragraph</p>
<pre><code class = "html"><p>This is <em>important.</em></p>
</code></pre>
<p>The associated HTML.</p>
</section>
<section>
<h3>Selector: Position</h3>
<ul>
<li>Position selectors are more specific</li>
<li>They look for elements <em>inside</em> other elements</li>
<li>We seperate nested elements with a space</li>
</ul>
</section>
<section>
<h3>Selector: Position</h3>
<p>So this code:</p>
<pre><code class = "css">ul li a strong{
color: purple;
}
</code></pre>
<p>Means "find a strong tag inside a link inside a list item in an unordered list"</p>
<pre><code class = "html"><ul>
<li><a href="programs.html">Our <strong>program</strong></a></li>
</ul>
</code></pre>
</section>
<section>
<h3>Let's develop it</h3>
<ul>
<li>In your CSS file, try a position selector</li>
<li>Remember, you need to look for an element <em>inside</em> another element</li>
</ul>
</section>
<!-- IDs and Classes-->
<section>
<h3>Reusing code</h3>
<p>As a general coding principle, <strong>D</strong>on't <strong>R</strong>epeat <strong>Y</strong>ourself.
<p>To reuse CSS, we use IDs and classes.</p>
<img src="img/recycle.jpg" alt="Recycle symbol"/>
<p><small>Photo credit: <a href="http://www.flickr.com/photos/yomostro/2502577270/">Yo Mostro</a> <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/">cc</a></small></p>
</section>
<section>
<h3>IDs vs. Classes</h3>
<p><strong>ID</strong> -- Should only apply to one element on a webpage, i.e., a webpage only has one footer.<br />
The "#" is how you tell CSS "this is an id."</p>
<p><strong>Class</strong> -- Lots of elements can have the same class, i.e., There can be many warnings on one webpage.<br />
The "." is how you tell CSS "this is a class name."</p>
</section>
<section>
<h3>Selector: ID</h3>
<pre><code class = "css">#footer {
property: value;
}
</code></pre>
<p>Selects all elements with an id of "footer".</p>
<pre><code class="html"><p id="footer">Copyright 2011</p>
</code></pre>
<p>The associated HTML.</p>
</section>
<!-- Selectors Class-->
<section>
<h3>Selector: Class</h3>
<pre><code class = "css">.warning {
color: red;
}
</code></pre>
<p>Selects all elements with a class of "warning".</p>
<pre><code class = "html"><p class="warning">Run away!</p>
</code></pre>
<p>The associated HTML.</p>
</section>
<!-- Exercise-->
<section>
<h3>Let's develop it</h3>
<ul>
<li>Add an ID and class to a your HTML</li>
<li>Add CSS rules to target these elements</li>
</ul>
</section>
<!-- Cascading-->
<section>
<h3>Cascading</h3>
<p>Styles "cascade" down until changed</p>
<pre><code class = "css">p{
color:blue;
font-family: 'Helvetica';
}
.red {
color: red;
}
#special {
font-family: Arial;
}
</code></pre>
<pre><code class = "html"><p>Paragraph</p>
<p class ="red">Paragraph</p>
<p class = "red" id ="special">Paragraph</p>
</code></pre>
</section>
<section>
<h3>Cascading priority</h3>
<p>Your browser assigns different priorities to CSS depending on the type of selector.</p>
<ol>
<li>Important! - <strong>Most Important</strong></li>
<li>In line CSS</li>
<li>ID</li>
<li>Class</li>
<li>Element - <strong>Least Important</strong></li>
</ol>
</section>
<section>
<h3>Cascading priority</h3>
<p>Your browser also assigns priority based on the specificity of the selection. More specific selectors have higher priority.</p>
<pre><code class = "css">.main .sale .clearance p{ //Most specific
color: red;
}
.header .title p{
color: green;
}
.footer p{ //Least specific
color: blue;
}
</code></pre>
</section>
<section>
<h3>Cascading priority</h3>
<p>The tie-breaker is position. Rules lower in the file overwrite rules higher in the file</p>
<pre><code class = "css">a{
background-color: yellow;
}
a{
background-color: teal;
}
a{ //This rule wins
background-color: black;
}
</code></pre>
</section>
<!-- Properties-->
<section>
<h3>CSS Properties</h3>
<p>Many CSS properties have self-explanatory names:</p>
<ul>
<li>background-color</li>
<li>font-family</li>
<li>font-size</li>
<li>color</li>
<li>width</li>
<li>height</li>
</ul>
<p><a href = "https://developer.mozilla.org/en-US/docs/CSS/CSS_Reference">Comprehensive list of all CSS properties</a></p>
</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>