-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path04-css-intro.html
More file actions
309 lines (249 loc) · 12.4 KB
/
04-css-intro.html
File metadata and controls
309 lines (249 loc) · 12.4 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>How CSS works</title>
<meta name="description" content="How CSS works">
<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">
<!--[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 class="small">
<h1 class="opening special-margin">How CSS works</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">
<p>Let’s try one more analogy, just to explain how fluid HTML, CSS can be:</p>
<p>Think of a webpage as a play. Say, Shakespeare’s Romeo and Juliet:</p>
<p>The HTML is the script -- the lines the actors and actresses say as the play progresses. It’s “In Fair Verona, where we lay our scene”, it’s “What's in a name? that which we call a rose / By any other name would smell as sweet”. </p>
<p>The CSS is the costume and set design -- how everyone looks, and how the set looks. It’s the poofy shoulders, the cobblestone street, the oil lamps.</p>
</div>
</section>
<section class="small">
<img src="images/romeo1.jpg" />
<div class="notes">
<p>Two people can take the same content and style it very differently. In terms of Romeo and Juliet, you have the classic 1968 version, with swords, tunics and cobblestone streets.</p>
</div>
</section>
<section class="small">
<img src="http://img101.fansshare.com/photos/paulrudd/romeo-and-julia-still-romeo-and-juliet-745865763.jpg"/>
<div class="notes">
<p>And you have the 1996 version with Leonardo di Caprio, guns and suits. The two movies have the exact same lines, but they look and feel very different. That’s what CSS can do to HTML.</p>
</div>
</section>
<section>
<h2>What CSS is used for</h2>
<ul>
<li class="fragment">Change <span style="color: #00b29e">color</span> and <span style="background-color: #00b29e">background color</span></li>
<li class="fragment">Make text <span style="font-size: 1.3em">larger</span>, <strong>bold</strong> and <em>italic</em></li>
<li class="fragment"><span style="font-family: Georgia">Use a different font altogether</span></li>
<li class="fragment">Add <span style="border: 1px solid gray;">borders</span> and <span style="margin: 0 50px">spacing</span></li>
<li class="fragment">Make things big <img src="images/presentations/css-intro/cat.png" width="125" style="vertical-align: middle"> and small <img src="images/presentations/css-intro/cat.png" width="50" > </li>
</ul>
<div class="notes">
</div>
</section>
<section class="small">
<h2>How to make a CSS file</h2>
<ol>
<li>Find the practice index.html file you made</li>
<li>In the "practice" folder, make a folder named "css"</li>
<li>Create a new file in that folder named styles.css. It's okay if it's empty.</li>
</ol>
<img src="images/4-lecture-css.png"/>
<div class="notes">
Next, let's tell the HTML where this file is.
</div>
</section>
<section data-markdown class="small">
<h2 class="special-smaller">Linking your HTML to the CSS</h2>
<pre><code contenteditable style="margin-top: 20px;"><html>
<head>
<title>Consider the lobster</title>
<!-- Our new CSS link: -->
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<h1>Consider the lobster</h1>
<p>The point is that <strong>lobsters</strong> are basically <br/>giant sea-insects.</p>
</body>
</html>
</code></pre>
<div class="notes">
<p>Under the title tag, we can put in a link tag. -- You'll notice the link tag doesn't have a closing tag. Tags like this are called "empty elements"; they will never contain anything, they only have attributes.</p>
<p>Looking at what it says: "rel" stands for relation, and "href" stands for hypertext reference (remember how HTML stands for Hyper Text Markup Language? Yeah, you'll never have to think about that fact again.) So this essentially says, the reference I'm about to give you is a stylesheet, and here it is, at css/styles.css.</p>
<p>Okay, let's look at some CSS.</p>
</div>
</section>
<!-- Example of nested vertical slides -->
<section data-markdown>
<h2>An example</h2>
<div style="float:left; width: 700px; text-align:left;">index.html</div><div style="float:left;">styles.css</div>
<div style="clear:both;"></div>
<pre class="double-editor" style="width:680px;"><code style="width:660px;" contenteditable ><html>
<head>
<title>Consider the lobster</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<h1>Consider the lobster</h1>
<p>The point is that <strong>lobsters</strong><br/> are basically giant sea-insects.</p>
</body>
</html>
</code></pre>
<pre class="double-editor" style="width:220px;"><code contenteditable>h1 {
color: red;
}
</code></pre>
<div style="clear:both;"></div>
<div class="notes">
So what does this do? Can anyone guess?
</div>
</section>
<section>
<h3 class="al" style="margin-top:180px; color:red; text-shadow:none;">Consider the lobster</h3>
<p class="al">The point is that <strong>lobsters</strong> are basically giant sea-insects.</p>
<div class="notes">
Right, it changed the h1 tag to red. So let's look at that CSS rule up close.
</div>
</section>
<section class="small">
<img src="images/css.png"/>
<div class="notes">
<p>This is called a CSS rule, and it has three parts:</p>
<ol>
<li>A <strong>selector</strong>, this is where you pick which tags to affect. Here, I've picked every h1. </li>
<li>A <strong>property</strong>, this is where you pick what aspect of the tag to change. I want to change its color.</li>
<li>And a <strong>value</strong>, which is what we set the property to. I picked red, 'cause you know, lobsters.</li>
</ol>
<br/><br/>
<p>So now you know what these mean, here's another way to think about it. And it's how I think about it when I'm coding.</p>
</div>
</section>
<section class="small">
<h2>While writing CSS, go through these steps</h2>
<ol>
<li><strong>What am I trying to do?</strong> <br/>I want my headline to be red</li>
<li><strong>What is the element called?</strong> <br/>Let's see, I'm using <h1>, it's what's in my HTML</li>
<li><strong>What's the property I need to use?</strong> <br/>Let's look up the CSS property for colors</li>
<li><strong>What's the value I want?</strong> <br/>Ha, red is just "red" (we can look this up too)</li>
</ol>
<div class="notes">
<p>But it doesn't have to stop with one property.</p>
</div>
</section>
<section data-markdown class="small">
<pre><code contenteditable style="margin-top: 20px;">
h1 {
color: red;
font-family: ‘Comic Sans MS’;
}
</code></pre>
<h3 class="al" style="margin-top:40px; color:red; text-shadow:none; font-family: 'Comic Sans MS';">Consider the lobster</h3>
<p class="al">The point is that <strong>lobsters</strong> are basically giant sea-insects.</p>
<div class="notes">
<p>So this says, all H1s should be the color red and use the font ‘Comic Sans MS’.</p>
<p>What if we want to change how the paragraphs look? We can add another rule. </p>
</div>
</section>
<section data-markdown class="small">
<pre><code contenteditable style="margin-top: 20px;">
h1 {
color: red;
font-family: ‘Comic Sans MS’;
}
p {
font-size: 18px;
}
</code></pre>
<h3 class="al" style="margin-top:40px; color:red; text-shadow:none; font-family: 'Comic Sans MS';">Consider the lobster</h3>
<p class="al" style="font-size: 18px;">The point is that <strong>lobsters</strong> are basically giant sea-insects.</p>
<div class="notes">
<p>So you're starting to get the hang of reading CSS. Before we let you write your own, we wanted to show you one more thing.</p>
<p>Colors. What if I don't want it to be generic red? How do I tell the Internet what color I want it to be? With numbers, or more specifically, hex codes.</p>
</div>
</section>
<section data-markdown class="small">
<pre><code contenteditable style="margin-top: 20px;">
h1 {
color: #FF0000;
}
</code></pre>
<img src="images/hex-codes.png"/>
<div class="notes">
<p>These aren't even all the options for red. But if you ever are stuck, there are great tools out there for picking colors, let's google it together.</p>
</div>
</section>
<section class="small">
<h2>Looking up CSS</h2>
<p>Don't know how to write a CSS property? Google it!</p>
<img src="images/presentations/css-intro/search-full.png">
<div class="notes">
</div>
</section>
<section>
<h2>With your mentors:</h2>
<ol>
<li>Practice making a CSS file, linking it, and writing CSS, <a href="http://codewithme.us/portland/exercises.html#lesson-4">following the instructions on the exercise sheet</a>. Try out these properties:
<ul>
<li>color, font-family, font-size, background-color</li>
<li>Try looking up: font-weight, underline and italic</li>
</ul>
</li>
<li>Do exercise #4: <a href="http://codewithme.us/portland/exercises.html#exercise-4">Style the Onion article with CSS</a></li>
</ol>
<div class="notes">
<p>So that’s the gist of it. We’ll let your mentors help you get some CSS on your page, and they’ll show you some more properties. When you’re feeling comfortable with that, we have an exercise for you to style your HTML page in a certain way. </p>
</div>
</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>