forked from gdiDFW/gdi-responsive
/
class4.html
400 lines (340 loc) · 13.9 KB
/
class4.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Class 4 (Responsive Web Design, Girl Develop IT)</title>
<meta name="description" content="This is the Girl Develop It Responsive Web Design course. Materials by Catherine Farman, based on material by Sophie Shepherd.
The course is meant to be taught in 4 two-hour sections. Each of the slides and practice files are customizable according to the needs of a given class or audience.">
<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 href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="reveal.js/css/reveal.css">
<link rel="stylesheet" href="reveal.js/css/theme/css/gdisunny.css" id="theme">
<!-- For syntax highlighting -->
<!-- light editor--><link rel="stylesheet" href="reveal.js/lib/css/light.css">
<!-- dark editor<link rel="stylesheet" href="reveal.js/lib/css/dark.css"> -->
<!-- If use the PDF print sheet so students can print slides-->
<link rel="stylesheet" href="reveal.js/css/print/pdf.css" type="text/css" media="print">
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<!-- Opening slide -->
<section>
<img src = "images/gdi_logo_badge.png" class="badge">
<h3>Responsive Web Design</h3>
<h4>Class 4</h4>
</section>
<!-- Opening slide -->
<section>
<h3>Class 4 Slides:</h3>
<p class="blue" style="font-size: 3em; text-decoration: underline;">cfarm.co/rwd4</p>
</section>
<!-- Welcome-->
<section>
<h3>Welcome!</h3>
<div>
<p>Girl Develop It is here to provide affordable and accessible programs to learn software through mentorship and hands-on instruction.</p>
<p class ="green">Some "rules"</p>
<ul>
<li>We are here for you!</li>
<li>Every question is important</li>
<li>Help each other</li>
<li>Have fun</li>
</ul>
</div>
</section>
<section>
<h3>Performance</h3>
<div class = "left-align">
<p class="left-align">Best Practices for Mobile Performance from W3C</p>
<ul>
<li>
Keep the number of externally linked resources to a minimum. Each linked resource (images, style sheets and other objects) requires a separate request across the network. This may add significantly to the load time of the page in the mobile context.
<br>
Solution: Use Sprites for images, minify & combine CSS, minify & combine JS
</li>
<li>
Limit content to what the user has requested.
Mobile users often pay for bandwidth, so offering them content that is extraneous to their needs, especially advertising, costs them time and money and contributes to an unsatisfactory experience. In general, the user's consent should be sought before initiating the download of content.
*if hiding content, use appropriate methods to NOT load the content if it's not going to be useful for mobile user*
*P.S. if it's not useful for a mobile user, it's probably not useful for anyone. consider getting rid of it for ALL devices*
</li>
</ul>
</div>
</section>
<section>
<h3>Welcome!</h3>
<div class = "left-align">
<p class = "blue">Tell us about yourself.</p>
<ul>
<li>Who are you?</li>
<li>What do you hope to get out of the class?</li>
<li>What's something no one in this room knows about you?</li>
</ul>
</div>
</section>
<!-- Terms-->
<section>
<h3>Terms</h3>
<ul>
<li>
<div class = "blue">Responsive Design</div>
<div>Fluid grids + Flexible Images/Video + Media Queries</div>
</li>
<li>
<div class = "blue">Viewport</div>
<div>The visible area of a webpage in a browser window</div>
</li>
<li>
<div class = "red">Mobile App</div>
<div>Software that is downloaded to a mobile device - we will not cover this.</div>
</li>
<li>
<div class = "red">Mobile website</div>
<div>A separate website with its own domain built to target 'mobile devices', typically meaning smartphones. We're not covering this either.</div>
</li>
</ul>
</section>
<!-- Tools -->
<section>
<h3>Tools</h3>
<ul>
<li>
<div class = "yellow">Browser:</div>
<div>Chrome</div>
<div>Firefox</div>
</li>
<li>
<div class = "yellow">Development Toolkit:</div>
<div>Chrome - Inspector</div>
<div>Firefox - Firebug</div>
</li>
<li>
<div class = "yellow">Text Editor:</div>
<div><a href="http://www.sublimetext.com/2">Sublime Text - Mac or Windows</a><br>
<a href="http://www.sublimetext.com/2">sublimetext.com/2</a></div>
</li>
</ul>
</section>
<!-- Nitty gritty 1 - What is RWD? -->
<section>
<h3>What is Responsive Web Design?</h3>
<blockquote class="quote">Responsive web design is an approach to web design in which a site is crafted to provide an optimal viewing experience—easy reading and navigation with a minimum of resizing, panning, and scrolling— <em>across a wide range of devices (from desktop computer monitors to mobile phones)</em>.</blockquote>
<cite>-Wikipedia</cite>
</section>
<!-- Examples -->
<section>
<h3>Examples</h3>
<ul>
<li><a href="http://www.bostonglobe.com/">Boston Globe</a></li>
<li><a href="http://www.microsoft.com/">Microsoft</a></li>
<li><a href="http://www.smashingmagazine.com/">Smashing Magazine</a></li>
<li><a href="http://worldwildlife.org/">World Wildlife Fund</a></li>
<li><a href="http://www.weblinc.com/">WebLinc</a></li>
<li><a href="http://mediaqueri.es/">Media Queries</a></li>
</ul>
</section>
<!-- Nitty gritty 1 - What is RWD? -->
<section>
<h3>Why bother?</h3>
<blockquote class="quote">Responsive web design is an approach to web design in which a site is crafted to provide an optimal viewing experience—easy reading and navigation with a minimum of resizing, panning, and scrolling— <em>across a wide range of devices (from desktop computer monitors to mobile phones)</em>.</blockquote>
<cite>-Wikipedia</cite>
</section>
<!-- Today's Goal -->
<section>
<h3>Goal for Today</h3>
<div>
Create a page that changes when you resize the browser viewport, and that fits on a mobile device screen.
</div>
</section>
<!-- 3 Keys to RWD-->
<section>
<h3>Four Keys to Responsive Design</h3>
<ul>
<li>A Fluid Grid</li>
<li>Flexible Images</li>
<li>Media Queries</li>
<li>Viewport Meta Tag</li>
</ul>
</section>
<!--Fluid Grid -->
<section>
<h3>The Fluid Grid</h3>
<ul>
<li>Define container widths as % instead of px</li>
<li>Target ÷ context = result <span class="blue">(Important - write this down!)</span></li>
</ul>
</section>
<!-- Target ÷ context = result -->
<section>
<h3>Target ÷ context = result</h3>
<ul>
<li>Target = width you desire in pixels</li>
<li>Context = the container of the element - a div or could be the viewport</li>
<li>Result is a percentage value you can use as a width in your CSS</li>
</ul>
</section>
<section>
<h3>The Fluid Grid</h3>
<img src="images/640div.png" alt="640 pixel div target width">
</section>
<section>
<h3>The Fluid Grid</h3>
<img src="images/960div.png" alt="940 pixel div container width">
</section>
<section>
<h3>The Fluid Grid</h3>
<div class="giant">
640px ÷ 960px = <br>
<strong>.666666667</strong>
</div>
</section>
<section>
<h3>The Fluid Grid</h3>
<div class="giant">
.666666667 =<br>
<strong class="green">66.6666667%</strong>
</div>
</section>
<section>
<h3>The Fluid Grid</h3>
<img src="images/fluidgrid1.png" alt="fluid div with percentage width">
</section>
<section>
<h3>The Fluid Grid</h3>
<img src="images/fluidgrid2.png" alt="fluid grid with percentages for all divs">
</section>
<section>
<h3>The Fluid Grid</h3>
<div>
<pre><code contenteditable class ="css">.container {
width: 100%;
margin: 0 40px;
}
.main-column {
width: 640px;
margin-right: 40px;
}
.sidebar {
width: 200px;
}</code></pre>
</div>
</section>
<section>
<h3>The Fluid Grid</h3>
<div>
<pre><code contenteditable class ="css">.container {
width: 960px;
margin: 0 04.1666667%;
}
.main-column {
width: 66.666667%;
margin-right: 04.1666667%;
}
.sidebar {
width: 20.833333%;
}</code></pre>
</div>
</section>
<!-- Flexible Images -->
<section>
<h3>Flexible Images</h3>
<ul>
<li>Like with fluid grids, percentages make images flexible in a page</li>
<li>Video, slideshows, etc can also be made flexible</li>
</ul>
<pre><code contenteditable class ="css">img {
max-width: 100%;
}</code></pre>
</section>
<!-- Exercise-->
<section>
<h3>Let's Develop It</h3>
<p>Create a new html file</p>
<p>Save it in our <span class="blue">/gdiJS/</span> folder</p>
<pre><code class ="html">
<html>
<head>
<title>My Site!</title>
</head>
<body>
My site!
</body>
</html>
</code></pre>
</section>
<section>
<h3>Let's Develop It</h3>
<p>Create a new javascript file (a file that ends in .js)</p>
<p>Link it to your html file</p>
<pre><code class ="html">
<html>
<head>
<title>My Site!</title>
<script src="myjavascriptfile.js"></script>
</head>
<body>
My site!
</body>
</html>
</code></pre>
</section>
<section>
<h3>Let's Develop It</h3>
<h4>Lifetime Supply Calculator</h4>
<p>Ever wonder how much a lifetime supply of your favorite snack or drink is?</p>
<ul>
<li>Store your age in a variable</li>
<li>Store your maximum in a variable</li>
<li>Store an estimated amount per day in a variable</li>
<li>Calculate how many you would eat/drink for the rest of your life.</li>
<li>Output the result in an alert(see below) like so: "You will need X _____s to last you until your old age of N"</li>
</ul>
<pre><code contenteditable class ="javascript">
alert(answer);
</code></pre>
</section>
<!-- -->
<section>
<h2>Questions?</h2>
<div style = "font-size:1200%; height:100%; margin-top:40%" class ="blue">?
<div class ="clear"></div></div>
</section>
</div>
<footer>
<div class="copyright">
Responsive Web Design ~ 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>
<script src="reveal.js/lib/js/head.min.js"></script>
<script src="reveal.js/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,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'none', // default/cube/page/concave/zoom/linear/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'reveal.js/plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>