-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path05-css-classes.html
More file actions
375 lines (311 loc) · 14.8 KB
/
05-css-classes.html
File metadata and controls
375 lines (311 loc) · 14.8 KB
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS classes</title>
<meta name="description" content="CSS Classes">
<meta name="author" content="Code with me, Tom Giratikanon, Sisi Wei">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link href='http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/theme/default.css">
<link rel="stylesheet" href="css/codewithme.css">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<script>
// If the query includes 'print-pdf' we'll use the PDF print sheet
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Used to fade in a background when a specific slide state is reached -->
<div class="state-background"></div>
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1 class="opening special-margin">CSS classes</h1>
<div class="small-logo-container disappear">
<img src="images/basic-logo-tan-bg.png"/>
<div class="copyright">© <span>2013</span></div>
</div>
<div class="notes">
[go to next slide]
</div>
</section>
<section data-markdown class="small">
<pre><code contenteditable style="margin-top: 20px;">
p {
font-size: 18px;
font-family: Georgia;
}
</code></pre>
<div class="notes">
<p>All right, so you've done some CSS. This looks pretty familiar doesn't it? Easy peasy.</p>
<p>What you've been doing, is using CSS to order around the HTML tags you've written, like "p" or "h1".</p>
<p>But you can have multiple paragraphs on a page right? What if you want to style one p tag, but not the rest? Think of your byline, or your photo captions. They shouldn't look like the main article text.</p>
<p>That’s where CSS classes come in. They let you make up names for individual html tags. [PAUSE] Think of styling HTML like talking to people. You can talk to a group of people at once, or you can talk to a specific person by using his or her name.</p>
</div>
</section>
<section>
<h2 class="vertical-center">Any mentors in the house?</h2>
<div class="notes">
<p>Have a few mentors come up. They'll each hold up a sheet of paper with some attributes. We'll ask them to do different things like: turn around, jump, hide.</p>
</div>
</section>
<section data-markdown>
<div style="float:left; width: 680px; text-align:left;">index.html</div><div style="float:left;">styles.css</div>
<div style="clear:both;"></div>
<pre class="double-editor" style="width:660px;"><code contenteditable style="width:640px;">
<p>By David Foster Wallace</p>
<p>Lobsters are basically giant sea-insects.</p>
</code></pre>
<pre class="double-editor" style="width:240px;"><code contenteditable>p {
text-decoration:
underline;
}
</code></pre>
<input type="text"><input type="text"><input type="text"><input type="text">
<div style="clear:both;"></div>
<p class="al" style="margin-top: 15px;"><strong>How do I create a CSS class?</strong></p>
<p class="al fragment" style="margin-top: 20px;">Give any HTML tag a name by adding<br/><p class="make-up-a-name"></p>
<p class="al fragment" style="margin-top: 20px;"><strong>How do I tell it what to do?</strong></p>
<p class="al fragment" style="margin-top: 20px;">Refer to any class in your CSS by typing<br/>.make-up-a-name{}</p>
</section>
<section data-markdown>
<div style="float:left; width: 680px; text-align:left;">index.html</div><div style="float:left;">styles.css</div>
<div style="clear:both;"></div>
<pre class="double-editor" style="width:660px;"><code contenteditable style="width:640px;"><html>
<head>
<title>Consider the lobster</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<h1>Consider the lobster</h1>
<p>By David Foster Wallace</p>
<p>The point is that lobsters are basically <br/>giant sea-insects.</p>
</body>
</html>
</code></pre>
<pre class="double-editor" style="width:240px;"><code contenteditable>p {
font-size: 24px;
}
</code></pre>
<div style="clear:both;"></div>
<h3 class="al" style="margin:20px 0 10px 0;">Consider the lobster</h3>
<p class="al" style="font-size:24px;">By David Foster Wallace</p>
<p class="al" style="font-size:24px;">The point is that lobsters are basically giant sea-insects.</p>
</section>
<section data-markdown>
<div style="float:left; width: 680px; text-align:left;">index.html</div><div style="float:left;">styles.css</div>
<div style="clear:both;"></div>
<pre class="double-editor" style="width:660px;"><code style="width:640px;"><html>
<head>
<title>Consider the lobster</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<h1>Consider the lobster</h1>
<p class="<span style="color: orange;">byline</span>">By David Foster Wallace</p>
<p>The point is that lobsters are basically <br/>giant sea-insects.</p>
</body>
</html>
</code></pre>
<pre class="double-editor" style="width:240px;"><code>p {
font-size: 24px;
}
.<span style="color: orange;">byline</span> {
font-size: 20px;
}
</code></pre>
<div style="clear:both;"></div>
<h3 class="al" style="margin:20px 0 10px 0;">Consider the lobster</h3>
<p class="al" style="font-size:20px;">By David Foster Wallace</p>
<p class="al" style="font-size:24px;">The point is that lobsters are basically giant sea-insects.</p>
</section>
<section data-markdown>
<!-- <h2>Classes can go anywhere</h2> -->
<div style="float:left; width: 680px; text-align:left;">index.html</div><div style="float:left;">styles.css</div>
<div style="clear:both;"></div>
<pre class="double-editor" style="width:660px;"><code style="width:640px;"><body>
<h1 class="<span style="color: lightgreen;">green</span>">Consider the lobster</h1>
<p class="<span style="color: #E3CEAB;">byline</span>">By David Foster Wallace</p>
<p>The point is that lobsters are basically giant sea-insects.</p>
</body>
</code></pre>
<pre class="double-editor" style="width:240px;"><code>p {
font-size: 24px;
}
.byline {
font-size: 20px;
}
.<span style="color: lightgreen;">green</span> {
color: green;
}
</code></pre>
<div style="clear:both;"></div>
<h3 class="al" style="margin:20px 0 10px 0; color: green; text-shadow:none;">Consider the lobster</h3>
<p class="al" style="font-size:20px;">By David Foster Wallace</p>
<p class="al" style="font-size:24px;">The point is that lobsters are basically giant sea-insects.</p>
</section>
<section data-markdown>
<!-- <h2>Classes can go anywhere</h2> -->
<div style="float:left; width: 680px; text-align:left;">index.html</div><div style="float:left;">styles.css</div>
<div style="clear:both;"></div>
<pre class="double-editor" style="width:660px;"><code style="width:640px;"><body>
<h1 class="<span style="color: lightgreen;">green</span>">Consider the lobster</h1>
<p class="<span style="color: #E3CEAB;">byline</span>">By David Foster Wallace</p>
<p class="<span style="color: lightgreen;">green</span>">The point is that lobsters are <br/>basically giant sea-insects.</p>
</body>
</code></pre>
<pre class="double-editor" style="width:240px;"><code>p {
font-size: 24px;
}
.byline {
font-size: 20px;
}
.<span style="color: lightgreen;">green</span> {
color: green;
}
</code></pre>
<div style="clear:both;"></div>
<h3 class="al" style="margin:20px 0 10px 0; color: green; text-shadow:none;">Consider the lobster</h3>
<p class="al" style="font-size:20px;">By David Foster Wallace</p>
<p class="al" style="font-size:24px; color: green;">The point is that lobsters are basically giant sea-insects.</p>
</section>
<section data-markdown class="small">
<!-- <h2>Multiple classes</h2> -->
<div style="float:left; width: 680px; text-align:left;">index.html</div><div style="float:left;">styles.css</div>
<div style="clear:both;"></div>
<div style="float:left; width: 680px;">
<pre class="double-editor" style="width:660px;"><code style="width:640px;"><body>
<h1 class="<span style="color: lightgreen;">green</span>">Consider the lobster</h1>
<p class="<span style="color: #E3CEAB;">byline</span> <span style="color: lightgreen;">green</span>">By David Foster Wallace
</p>
<p class="<span style="color: lightgreen;">green</span>">The point is that green lobsters are basically
giant sea-insects.</p>
</body>
</code></pre>
<div style="float:left;">
<h3 class="al" style="margin:20px 0 10px 0; text-shadow:none; color:green;">Consider the lobster</h3>
<p class="al" style="font-size:20px; color:green;">By David Foster Wallace</p>
<p class="al" style="font-size:24px; color:green;">The point is that lobsters are basically giant sea-insects.</p>
</div>
</div>
<pre class="double-editor" style="width:240px;"><code>p {
font-size: 24px;
}
.byline {
font-size: 20px;
}
.<span style="color: lightgreen">green</span> {
color: green;
}
</code></pre>
<div style="clear:both;"></div>
<div class="notes">
<p>HTML elements can also have multiple classes! And it doesn't matter what order you write them in.</p>
</div>
</section>
<section data-markdown class="small">
<!-- <h2>Remember the cascade?</h2> -->
<div style="margin: 0 auto; width: 900px;">
<div style="float:left; width: 900px; text-align:left;">styles.css</div>
<pre style="width:300px; float:left;"><code style="width: 300px; margin-left:0px;">
p {
font-size: 20px;
}
.byline{
font-size: 30px;
}
</code></pre>
<div style="float:left; width: 550px; margin: 0 0 0 50px;">
<p class="al" style="font-size:20px; margin-top: 80px;">By David Foster Wallace</p>
<p class="al" style="font-size:30px; margin-top: 85px;">By David Foster Wallace</p>
</div>
<div style="clear:both;"></div>
<div class="fragment">
<p style="font-size: 30px; margin: 20px 0 0 0; text-align:left;">If you have an HTML element like this:</p>
<pre style="width:900px;"><code style="width:900px;margin-left:0px;"><p class="byline">By David Foster Wallace</p></code></pre>
<p class="al" style="font-size:30px; margin-top:35px;">What's the font size? 20px? or 30px?</p>
</div>
</div>
<div class="notes">
<p>[Explain top]</p>
<p>[So, what happens, when they all pointed to the same element? PRESS ENTER. ]</p>
</div>
</section>
<section data-markdown class="small">
<!-- <h2>Remember the cascade?</h2> -->
<div style="margin: 0 auto; width: 900px;">
<div style="float:left; width: 900px; text-align:left;">styles.css</div>
<pre style="width:300px; float:left;"><code style="width: 300px; margin-left:0px;">
p {
font-size: 20px;
}
.byline {
font-size: 30px;
}
</code></pre>
<div style="float:left; width: 550px; margin: 0 0 0 50px;">
<p class="al" style="font-size:20px; margin-top: 80px;">By David Foster Wallace</p>
<p class="al" style="font-size:30px; margin-top: 85px;">By David Foster Wallace</p>
</div>
<div style="clear:both;"></div>
<div>
<p style="font-size: 30px; margin: 20px 0 0 0; text-align:left;">If you have an HTML element like this:</p>
<pre style="width:900px;"><code style="width:900px;margin-left:0px;"><p class="byline">By David Foster Wallace</p></code></pre>
<p class="al" style="font-size:30px; margin-top:35px;">What's the font size? 20px? or <span class="number-highlight">30px</span>?</p>
</div>
</div>
</section>
<section>
<p style="font-size: 3em; margin: 140px 0px 0px;"><a href="http://www.propublica.org" target="_blank">propublica.org</a></p>
<p>Seeing cascades with the inspector</p>
</section>
<section>
<h2>With your mentors:</h2>
<ul>
<li>Practice <a href="http://codewithme.us/portland/exercises.html#lesson-5a">writing CSS classes</li>
<li>Do exercise #5b: <a href="http://codewithme.us/portland/exercises.html#lesson-5b">Design it Twitter-style, part one</li>
</ul>
<!-- <h2 class="marq" style="margin-top:100px;"><marquee><BLINK>Lunch is here! Lunch is here! Lunch is here! Lunch is here! Lunch is here!</BLINK></marquee></h2> -->
</section>
</div>
<!-- The navigational controls UI -->
<aside class="controls">
<a class="left" href="#">◄</a>
<a class="right" href="#">►</a>
<a class="up" href="#">▲</a>
<a class="down" href="#">▼</a>
</aside>
<!-- Presentation progress bar -->
<div class="progress"><span></span></div>
</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,
transition: Reveal.getQueryHash().transition || 'linear', // default/cube/page/concave/linear(2d)
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/highlight.js', async: true, callback: function() { window.hljs.initHighlightingOnLoad(); } },
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'lib/js/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'lib/js/data-markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'socket.io/socket.io.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } },
{ src: 'plugin/speakernotes/client.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } },
]
});
</script>
</body>
</html>