-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass7.html
427 lines (398 loc) · 13.7 KB
/
class7.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Girl Develop It - Intro to HTML + CSS, Class 5</title>
<meta name="description" content="Girl Develop It's Intro to HTML and CSS course, customized by Liz Shaw">
<meta name="author" content="Liz Shaw">
<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/slides.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">
<!-- Code Your Own Website -->
<section>
<h2>HTML / CSS 4wk series</h2>
<img src="img/circle-gdi-logo.png" alt="GDI Logo" />
<h3>Responsive Web Design</h3>
<p>
<small>Session 7</small>
</p>
</section>
<section data-background="#f05b62">
<h1 style="color: #fafafa;">Responsive </h1>
</section>
<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 smart phones. We're not covering this either.</div>
</li>
</ul>
</section>
<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>
<section>
<h3>Examples</h3>
<ul>
<li><a href="http://www.bostonglobe.com/">Boston Globe</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://mediaqueri.es/">Media Queries</a></li>
</ul>
</section>
<!-- Why does it matter? -->
<section>
<h3>Why bother?</h3>
<p>As of January 2017:</p>
<ul>
<li>77% of American adults have a smartphone</li>
<li>42% own a tablet computer</li>
<li>32% own an e-reader</li>
</ul>
<a href='http://www.pewinternet.org/fact-sheets/mobile-technology-fact-sheet/'>Resource and further reading</a>
</section>
<section>
<h3>Four Keys to Responsive Design</h3>
<ul>
<li>A Fluid Grid</li>
<li>Flexible Images</li>
<li>Viewport Meta Tag</li>
<li>Media Queries</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/examplegrid_target.png" alt="480 pixel div target width">
</section>
<section>
<h3>The Fluid Grid</h3>
<img src="images/examplegrid_context.png" alt="960 pixel div container width">
</section>
<section>
<h3>The Fluid Grid</h3>
<div class="giant">
480px ÷ 960px = <br>
<strong>.50</strong>
</div>
</section>
<section>
<h3>The Fluid Grid</h3>
<div class="giant">
.50 =<br>
<strong class="green">50%</strong>
</div>
</section>
<section>
<h3>The Fluid Grid</h3>
<img src="images/examplegrid_target_percent.png" alt="fluid div with percentage width">
</section>
<section>
<h3>The Fluid Grid</h3>
<img src="images/examplegrid_all_percent.png" alt="fluid grid with percentages for all divs">
</section>
<section>
<h3>The Fluid Grid</h3>
<div>
<pre><code contenteditable class ="css">.container {
width: 960px;
margin: 0 20px;
}
.content .main-column {
width: 480px;
margin-right: 20px;
}
.content .hero-image {
width: 400px;
}</code></pre>
</div>
</section>
<section>
<h3>The Fluid Grid</h3>
<div>
<pre><code contenteditable class ="css">.container {
width: 960px;
margin: 0 4.1667%;
}
.content .main-column {
width: 50%;
margin-right: 4.1667%;
}
.content .hero-image {
width: 41.667%;
}</code></pre>
</div>
</section>
<!-- Exercise-->
<section>
<h3>Let's Develop It</h3>
<ul>
<li>Open up your template index.html file in a browser</li>
<li>Open style.css in the css folder in a text editor</li>
<li>Make your page layout fluid!</li>
<li>Hint: try this helpful calculator at <a href="http://rqrwd.com/">rqrwd.com</a></li>
<!-- <li>Bonus: Test on devices by uploading your files via <a href="class1.html#/23">FTP</a></li> -->
</ul>
<div>
<pre><code contenteditable class ="css">.container {
width: 100%;
margin: 0 4.1667%;
}
.content .main-column {
width: 50%;
margin-right: 4.1667%;
}</code></pre>
</div>
</section>
<section data-background="#f05b62">
<h1 style="color: #fafafa;">Using Max-width</h1>
</section>
<section>
<h3>Let's Develop It</h3>
<ul class="left-align">
<li>Add max-width values to your elements with percentages.</li>
<li>Hint: Use your old <strong>pixel width values</strong> for your max-width values. (Aren't you glad you kept those in a comment?)</li>
</ul>
<pre><code class ="css">.gifs img {
width: 33%;
max-width: 80px;
}
.container {
width: 100%;
max-width: 960px;
}
</code></pre>
</section>
<section>
<h3>Take a look on a "phone" or "tablet"</h3>
<ul>
<li>In Chrome, open the Dev tools (View > Developer > Developer Tools) and follow <a href="http://www.sitepoint.com/use-mobile-emulation-mode-chrome/">these instructions</a></li>
<li>In Firefox, select "Responsive Design View" from the Web Developer submenu in Tools or Menu list (<a href="https://developer.mozilla.org/en-US/docs/Tools/Responsive_Design_View">See instructions</a>)</li>
</ul>
</section>
<section data-background="#f05b62">
<h1 style="color: #fafafa;">Viewport Meta Tag</h1>
</section>
<section>
<h3>Viewport <meta> Tag</h3>
<p>Makes your page scale correctly on mobile devices.</p>
<div>
<pre style="width: 900px"><code contenteditable class ="html"><meta name="viewport" content="width=device-width"></code></pre>
</div>
<img src="images/no_meta_tag.png" class="fragment" width="300" />
<img src="images/meta_tag.png" class="fragment" width="300" />
</section>
<section>
<h3>Breakpoints</h3>
<p class="left-align">The points in your layout where you add a media query, or where things shift and change.</p>
<pre><code class ="css">/* this is a 60em or 960px wide breakpoint */
@media (min-width:60em) {
.container {
width: 100%;
max-width: 960px;
}
}
</code></pre>
</section>
<section>
<h3>???</h3>
<p>How do you know what breakpoint you're looking at??</p>
<ul>
<li>Inspector and Dev Tools to the rescue!! Resize with your inspector open to see the viewport size in pixels</li>
<li class="left-align">Add the <a href="http://seesparkbox.com/foundry/media_query_bookmarklet">Media Query bookmarklet</a> to your browser!</li>
</ul>
</section>
<section>
<h3>Breakpoints</h3>
<p class="left-align">These can be based on popular device sizes, like iPhone, iPad and desktop resolutions:</p>
<pre><code class ="css">.container { width: 100%; }
@media (min-width:320px) {
.container {
margin: 0 auto;
width: 320px;
}
}
@media (min-width: 768px) {
.container {
width: 768px;
}
}
@media (min-width: 960px) {
.container {
width: 960px;
}
}
</code></pre>
<p class="left">Example: <a href="http://www.eataly.com/">Eataly</a></p>
</section>
<section>
<h3>Breakpoints</h3>
<p class="left-align">Breakpoints can also be more fluid, and added only where the layout starts to look funky:</p>
<pre><code class ="css">.hero-image { width: 100%; }
@media (min-width:530px) {
.container {
float: left;
width: 41.6666666666667%; /* 400px/960px */;
}
}
</code></pre>
<p class="left-align">Example: <a href="http://bohconf.com/">BohConf</a></p>
</section>
<!-- Let's Develop It -->
<section>
<h3>Let's Develop It</h3>
<ul>
<li>Add media queries for breakpoints that are the size of popular mobile devices (phones, tablets, etc)</li>
<li>Look up these screen resolutions - try looking up your own devices</li>
<li>Try changing the widths at these breakpoints to mimic the rigid grid layouts we looked at.</li>
<!-- <li>Helpful tools:
<ul>
<li>
<a href="http://responsivepx.com/">Breakpoint Finder</a> - works on local sites (using localhost)
</li>
<li>
<a href="http://www.josscrowcroft.com/2011/code/window-size-bookmarklet/">Window Size Bookmarklet</a>
</li>
<li>
<a href="http://www.responsinator.com/">Responsinator</a> - mimics real device sizes
</li>
</ul>
</li> -->
</ul>
</section>
<!-- Flow -->
<!-- Thank you! -->
<section data-background="#f05b62">
<h1 style="color: #fafafa;">Homework</h1>
</section>
<section>
<h3>Homework</h3>
<p class="left-align">Make a mobile-first responsive site:</p>
<ul>
<li>Move ALL your floats & widths into a media query for 960px wide viewports and up.</li>
<li>Add mobile first styles for your CSS that's not inside a media query: widths, padding, floats as needed, etc.</li>
<li>Resize browser to see your media queries kick in at the larger screen size.</li>
</ul>
</section>
</div>
<footer>
<div class="copyright">
HTML & CSS 4wk Series <span class="red">♥</span> Boulder/Denver |
<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="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>
<script async src="//assets.codepen.io/assets/embed/ei.js"></script>
</body>
</html>