forked from anythingcodes/gdi-intermediate-html-css
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass3.html
More file actions
558 lines (518 loc) · 28.6 KB
/
class3.html
File metadata and controls
558 lines (518 loc) · 28.6 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
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Girl Develop It - Intermediate HTML + CSS, Class 3</title>
<meta name="description" content="Girl Develop It's Intermediate 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">
<!-- 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>Code Your Own Website</h2>
<img src="img/circle-gdi-logo.png" alt="GDI Logo" style="box-shadow:none" />
<h3>Intermediate HTML + CSS</h3>
<p>
<small>Class 3</small>
</p>
</section>
<section>
<h3>Animation Recap</h3>
<ul>
<li class="fragment">Add <code>transition</code> to the <span class="blue">before state</span></li>
<li class="fragment"><span class="green">Remember:</span> <code>transition</code> accepts two values,<br /><u class="fragment"> the CSS property </u> and <u class="fragment"> the duration </u> of the animation</li>
</ul>
<table class="data fragment" style="margin:1em auto;width:100%;">
<tr>
<th style="padding:0;">Before Selector</th>
<th style="padding:0">After Selector</th>
</tr>
<tr style="padding:0;">
<td class="fragment" style="padding:0;">
<pre class="css">
<code style="padding:5px">selector {
width: 100px;
transition: width 2s;
}</code>
</pre>
</td>
<td class="fragment" style="padding:0;">
<pre class="css">
<code style="padding:5px">selector:hover {
width: 500px;
}</code>
</pre>
</td>
</tr>
</table>
</section>
<section>
<h3>Animating Multiple Properties</h3>
<p class="fragment">To animate multiple properties, separate each effect with a comma</p>
<pre class="css fragment">
<code>selector {
transition: width 2s, background 5s;
}</code>
</pre>
<div class="fragment">
<p data-height="128" data-theme-id="0" data-slug-hash="GpLwGr" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/GpLwGr/'>Animating Multiple Properties - Before</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
</section>
<section>
<h3>Animating Multiple Properties</h3>
<p class="blue">Method 2: All Properties</p>
<p class="fragment">Use <code>all</code> to seamlessly transition all properties from before to after states at the <span class="green">same duration</span></p>
<pre class="css fragment">
<code>selector {
transition: all 3s;
}</code>
</pre>
<div class="fragment">
<p data-height="131" data-theme-id="0" data-slug-hash="gayQdW" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/gayQdW/'>Transitions Using 'all' - Before</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
<div class="fragment">
<p style="color:firebrick"><small><br />Sounds great, right? However, <code>all</code> has performance drawbacks, so use it sparingly! (<a href="http://codepen.io/anythingcodes/pen/NGmEoY/?editors=110" target="_blank">Example »</a>)</small></p>
</div>
</section>
<section>
<h3>Property: <em>box-shadow</em></h3>
<p>The <code>box-shadow</code> CSS3 property is often used to give a 3D effect when an element is hovered over</p>
<pre class="css fragment">
<code>selector {
box-shadow: horizontalShadow verticalShadow blurDistance color;
box-shadow: 10px 10px 5px grey;
}</code>
</pre>
<div class="fragment">
<p data-height="200" data-theme-id="0" data-slug-hash="zvQBKm" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/zvQBKm/'>CSS3 Generator: box-shadow </a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
<p class="fragment">Don't worry about memorizing this — use a <a href="http://css3gen.com/box-shadow/" target="_blank">generator</a> instead!</p>
</section>
<section>
<h3>Property: <em>opacity</em></h3>
<p><code>opacity</code> changes the opacity of the <span class="green">whole element</span></p>
<pre class="css">
<code>selector {
opacity: 0.5;
}</code>
</pre>
<p class="fragment">The value can be a number between <span class="blue">0 (translucent)</span> and <span class="blue">1.0 (opaque)</span></p>
<div class="fragment">
<p data-height="268" data-theme-id="0" data-slug-hash="WQBGBq" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/WQBGBq/'>Opacity vs. RBGA</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
</section>
<section>
<h3><em>opacity</em> in Hover States</h3>
<p class="fragment"><code>opacity</code> is commonly used in hover states to reveal transparent content</p>
<div class="fragment">
<p data-height="337" data-theme-id="0" data-slug-hash="XmwNdM" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/XmwNdM/'>Opacity and Hover - Before</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
</section>
<section>
<h2>Let's Develop It!</h2>
<p>You may have noticed that one of these things is not like the other. That's because one is a hover state!</p>
<p>Let's animate multiple properties (for example, <code>box-shadow</code> and <code>opacity</code>) for the hover states in the <span class="blue">About</span> section.</p>
<p><img src="img/home-hover.jpg" alt="Hover state for home image" /></p>
</section>
<section data-background="#f05b62">
<h1 style="color: #fafafa;font-size:3.7em">Additional Animation Effects</h1>
</section>
<section>
<h3>Property: <em>transition-delay</em></h3>
<p>Use <code>transition-delay</code> to delay when an animation begins</p>
<pre class="css fragment">
<code>selector {
transition: width 1s;
transition-delay: 3s;
}</code>
</pre>
<div class="fragment">
<p data-height="338" data-theme-id="0" data-slug-hash="PPgxEp" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/PPgxEp/'>Transition Delays</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
</section>
<section>
<h3>Property:<br/><em>transition-timing-function</em></h3>
<p class="fragment">The <span class="blue">timing function</span> changes how fast or slow the animation is at parts of the animation</p>
<pre class="css fragment" style="font-size:15px">
<code>selector {
transition: width 3.5s;
transition-timing-function: ease;
transition-timing-function: linear;
transition-timing-function: ease-in;
transition-timing-function: ease-out;
transition-timing-function: ease-in-out;
transition-timing-function: cubic-bezier(n,n,n,n);
}</code>
</pre>
<div class="fragment">
<p data-height="290" data-theme-id="0" data-slug-hash="JYVwgr" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/JYVwgr/'>Transition Timing Functions</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
<p class="fragment"><small><strong>Fun fact</strong>: The <span class="blue">timing function</span> is sometimes called the <span class="blue">speed curve</span></small></p>
</section>
<section>
<h3>Property:<br /><em>transition-timing-function</em></h3>
<p class="blue">Additional Notes</p>
<p class="fragment">If you don't specify a timing function, <span class="orange">ease</span> is used</p>
<p class="fragment">With <span class="orange">cubic-bezier</span>, you can create your own timing function</p>
<p class="fragment">Use <a href="http://cubic-bezier.com/" target="_blank">cubic-bezier.com</a> to make your own timing function, and compare it to the built-in timing functions (such as <span class="green">ease</span> and <span class="green">linear</span>)</p>
</section>
<section>
<h3>Property: <em>transform</em></h3>
<p class="fragment">Use <code>transform</code> to rotate, scale, skew, change the perspective, and <a href="http://www.w3schools.com/cssref/css3_pr_transform.asp" target="_blank">much more</a></p>
<pre class="css fragment">
<code>selector {
transform: translate3d(0, -3px, 0);
transform: rotate(360deg);
/* and more! */
}</code>
</pre>
<p class="fragment"><code>transform</code> has too many values to list — use <a href="http://www.css3maker.com/css3-transform.html" target="_blank">CSS3Maker</a> or <a href="http://css3please.com/" target="_blank">CSS3, please!</a> to generate them</p>
<p class="fragment">A transformation is often animated with <code>transition</code></p>
<div class="fragment">
<p data-height="179" data-theme-id="0" data-slug-hash="YyMBVR" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/YyMBVR/'>Transition + Transform - Before</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
</section>
<section>
<h2>Let's Develop It!</h2>
<ol>
<li>Copy <span class="green">index.html</span> and name the copy <span class="green">africa.html</span></li>
<li>Copy <span class="green">index.html</span> and name the copy <span class="green">diet.html</span></li>
<li>Copy <span class="green">index.html</span> and name the copy <span class="green">stripes.html</span></li>
</ol>
<p><br />You should now have four identical files with different names: <span class="orange">index.html</span>, <span class="orange">africa.html</span>, <span class="orange">diet.html</span>, and <span class="orange">stripes.html</span></p>
</section>
<!-- Responsive Grid Systems -->
<section data-background="#f05b62">
<h1 style="color: #fafafa;font-size:3.7em">Responsive Grid Systems</h1>
</section>
<section>
<h3>What is a grid system?</h3>
<p class="fragment">CSS for columns with margins, which is used to align content (<a href="http://www.responsivegridsystem.com/layouts/" target="_blank">Example »</a>)</p>
<p class="fragment"><img src="img/design-grid.gif" alt="Our design with a grid" class="right" style="margin-left:1em" />Grid systems use <span class="orange">relative units</span> (e.g. <span class="blue">%</span> and <span class="blue">vw</span>) instead of fixed units (e.g. <span class="blue">px</span>) so that the layout adjusts according to the viewport width</p>
<p class="fragment">At narrower <span class="orange">breakpoints</span> (e.g. tablet or mobile), each column expands to fill the viewport in a <span class="orange">single column</span></p>
</section>
<section>
<h3>Why do we ♥ grid systems?</h3>
<ul>
<li class="fragment"><span class="blue">Easier to Maintain</span>: It's easier to design and code new layouts when the structural guidelines have already been decided</li>
<li class="fragment"><span class="blue">Usability</span>: Uniformity and consistency are key to creating a website that your users will find easy to navigate, read and understand</li>
<li class="fragment"><span class="blue">Abides by the <a href="http://tympanus.net/codrops/2012/05/23/understanding-the-rule-of-thirds-in-web-design" target="_blank">'Rule of Thirds'</a></span>: Helps avoid arbitary design decisions. For developers, this means there are less layout exceptions to account for.</li>
<li class="fragment"><span class="blue">Faster to Code</span>: At different breakpoints, we can easily collapse everything into a single column</li>
<li class="fragment"><span class="blue">Fluid</span>: Fluid layouts are the way of the future <span class="green">☺</span></li>
</ul>
</section>
<section>
<h4>Grids Are Everywhere!</h4>
<img src="img/grid-boston.jpg" alt="Grids: Boston vs. NYC" style="margin:0" />
</section>
<section>
<h3>Popular Frameworks<br />Based On Grids</h3>
<p class="fragment">Most frameworks are on 12 columns or 16 columns, and include styling for common elements such as headings, buttons, and tables</p>
<div class="fragment">
<p><br /><a href="http://getskeleton.com/" target="_blank">Skeleton</a></p>
<p><a href="http://getbootstrap.com" target="_blank">Bootstrap</a></p>
<p><a href="http://foundation.zurb.com/" target="_blank">Foundation</a></p>
</div>
</section>
<section data-background="#f05b62">
<h2 style="color: #fafafa">But wouldn't you rather say you made your <em>own</em> grid system?</h2>
</section>
<section>
<h3>Coding Your Own Grid System</h3>
<ol style="font-size:85%;line-height:1.3">
<li class="fragment"><img src="workshop-files/designs/home-grid-measurements.png" alt="Our design on a grid" style="max-height:38vh;" class="right" />Determine the maximum width from the design. In our case, that's <span class="blue">1170px</span>. This will be used as a <code>max-width</code> on each row.</li>
<li class="fragment">Calculate the <span class="green">gutter</span> (the margin between columns) width as a percentage of the maximum width. In our case, that's <span class="blue">2.56%</span> (or 30px/1170px).</li>
<li class="fragment">Use a <a href="http://www.responsivegridsystem.com/calculator/" target="_blank">grid generator</a> to generate the CSS. (<span class="green">But don't worry — we've done this for you!</span>) Then reference these classes in your HTML.<!--</li>
<ul style="font-size:.7em;line-height:1.2" class="fragment">
<li>Calculate the width of a single column as a percentage. In our case, that's <span class="blue">5.986%</span>.</li>
<li>Reference the design to see how many columns and gutters should be used in your CSS calculations</li>
<li>For example, a column that spanned 6 of 12 columns would have a width of 48.72%, or (6 x 5.986%) + (5 x 2.56%)</li>
</ul>-->
</li>
</ol>
</section>
<section>
<h3>Grid System HTML</h3>
<p><small>Our grid CSS was generated with a <a href="http://www.responsivegridsystem.com/calculator/" target="_blank">grid generator</a>, but the unneccessary CSS has been removed. Today we'll be focusing on using the grid system in the HTML.</small></p>
<p class="fragment">Use the <span class="blue">row</span> class on each row of content:</p>
<pre class="html fragment">
<code><section class="row">
</section></code>
</pre>
<p class="fragment">Within the row, use the <span class="blue">column</span> class and the width class (e.g. <span class="blue">span_4_of_12</span>) on each column of content:</p>
<pre class="xml fragment">
<code><section class="row">
<div class="column span_4_of_12">
I'm the first of three columns!
</div>
<div class="column span_4_of_12">
I'm the second of three columns!
</div>
<div class="column span_4_of_12">
I'm the third of three columns!
</div>
</section></code>
</pre>
<p class="fragment green"><small><strong>Tip:</strong> To use multiple classes on a single element, separate each class with a space in your HTML as shown above.</small></p>
</section>
<!-- Let's Develop It! -->
<section>
<h2>Let's Develop It!</h2>
<p><small>Let's put our grid system to use in the HTML!</small></p>
<ol>
<li>Copy the grid CSS from <a href="http://codepen.io/raearnold/pen/ZBMmoB" target="_blank">this Code Pen</a> into your CSS file. Now it's ready to use in the HTML!</li>
<li><img src="workshop-files/designs/home-grid-measurements.png" alt="Our design on a grid" style="max-width:30vw;float:right;" />Add grid HTML to <span class="orange">index.html</span>, then style the <span class="green">About</span> and <span class="green">Mission</span> sections</li>
<li>Add grid HTML to <span class="orange">africa.html</span>, <span class="orange">diet.html</span>, and <span class="orange">stripes.html</span>. We'll style these pages next class!</li>
</ol>
<p style="clear:left;"><a href="class2.html#/4" target="_blank">View designs »</a></p>
</section>
<!-- Responsive Images -->
<section>
<h3>Responsive Images</h3>
<p class="fragment">To make images fit to their containers, some extra properties are required:</p>
<pre class="css fragment">
<code>img {
max-width: 100%;
box-sizing: border-box;
}</code>
</pre>
<p class="fragment">Together these two properties force images to stay within their containers</p>
<div class="fragment">
<p data-height="294" data-theme-id="0" data-slug-hash="avxxQp" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/avxxQp/'>Responsive Images - Before</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
<p class="fragment"><a href="http://codepen.io/anythingcodes/pen/PProaG" target="_blank">View result of CodePen »</a></p>
</section>
<!-- Let's Develop It!-->
<section>
<h2>Let's Develop It!</h2>
<ol>
<li>Let's make our images <em>truly</em> responsive!</li>
<li>Let's also make our <span class="blue">About</span> images circular with a border.</li>
</ol>
</section>
<!-- Gradients -->
<section>
<h3>Gradients</h3>
<p class="fragment">You can now make gradients with CSS3 — no image-editing required!</p>
<p class="fragment">Use <code>background-image</code> with <code>linear-gradient</code>:</p>
<pre class="css fragment">
<code>selector {
background-image: linear-gradient(red, white);
}</code>
</pre>
<p class="fragment">The first is the top color, while the second is the bottom color</p>
<div class="fragment">
<p data-height="118" data-theme-id="0" data-slug-hash="WQWBQN" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/WQWBQN/'>Linear Gradients - Two Values</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
</section>
<section>
<h3>Gradients</h3>
<p class="blue">Bonus Functionality</p>
<p class="fragment">You can use as many values as you want, and specify where the gradient should begin:</p>
<div class="fragment">
<p data-height="150" data-theme-id="0" data-slug-hash="xweNbX" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/xweNbX/'>Linear Gradients</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
<p class="fragment">You can even make <span class="green">radial gradients</span></p>
<p class="fragment">To save yourself some time, bookmark the <a href="http://www.colorzilla.com/gradient-editor/" target="_blank">Ultimate CSS Gradient Generator</a></p>
</section>
<!-- Let's Develop It! -->
<section>
<h2>Let's Develop It!</h2>
<p>Let's add a linear gradient to our <span class="blue">Mission</span> link!</p>
<p><img src="img/gradient-mission.png" alt="The gradient in our design" /></p>
<p>Feel free to use the <a href="http://www.colorzilla.com/gradient-editor/" target="_blank">Ultimate CSS Gradient Generator</a></p>
</section>
<!-- Media Queries -->
<section>
<h3>Media Queries</h3>
<p class="fragment">Visit your page and narrow the browser window</p>
<p class="fragment">The columns you set up are <span class="green">fluid</span> and <span class="green">responsive</span>, since they respond to the viewport width, but don't collapse into a single column</p>
<p class="fragment"><img src="img/responsive-single-column.gif" alt="Animation of columns collapsing into single column" style="box-shadow:none;padding:0;" /></p>
<p class="fragment">How do we make that happen? With <span class="blue">media queries</span></p>
</section>
<section>
<h3>Media Queries</h3>
<p class="fragment">Within each <span class="orange">media query rule</span>, put CSS rules you would like to override for that <span class="orange">breakpoint</span></p>
<pre class="css fragment">
<code>
@media screen and (max-width: 600px) {
.column {
margin: 1% 0;
width: 100%;
}
.some-other-class {
background-color: yellow;
}
}
</code>
</pre>
<p class="fragment">Always use media queries <span class="blue">at the end of your CSS file</span></p>
<p class="fragment green"><small><strong>Tip:</strong> Remember to watch your closing brackets!</small></p>
</section>
<section>
<h3>Common Media Query Uses</h3>
<ol>
<li class="fragment">To force columns to stack and fill up the whole screen width (<span class="green">what we'll be doing</span>):
<div class="fragment">
<p data-height="138" data-theme-id="0" data-slug-hash="WQBGOY" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/WQBGOY/'>Media Queries - Columns</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
</li>
<li class="fragment">Showing or hiding content at various breakpoints:
<div class="fragment">
<p data-height="138" data-theme-id="0" data-slug-hash="JYqRbX" data-default-tab="result" data-user="anythingcodes" class='codepen'>See the Pen <a href='http://codepen.io/anythingcodes/pen/JYqRbX/'>Media Queries</a> by Liz Shaw (<a href='http://codepen.io/anythingcodes'>@anythingcodes</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
</div>
</li>
</ol>
</section>
<section>
<h3>Recommendations</h3>
<p class="fragment">The temptation is to add breakpoints based on whatever device is popular at the time (e.g. 768px)</p>
<p class="fragment">This is a <span class="green">bad idea</span></p>
<p class="fragment"><img src="img/devices.png" alt="A pile of devices" style="float:left;" /><span class="fragment"><br />After all, responsive design is about <span class="orange">any</span> and <span class="orange">every</span> potential screen size!</span></p>
<p class="fragment" style="clear:left">The Golden Rule: Keep it fluid<br /><span class="blue">Add a breakpoint where your design breaks</span></p>
</section>
<section>
<h2>Let's Develop It!</h2>
<p>Let's add a mobile breakpoint to make the columns take up the entire viewport!</p>
</section>
<section>
<h3>Other Media Queries</h3>
<ol>
<li class="fragment">Targeting minimum viewport widths:
<pre class="css">
<code>@media screen and (min-width: 1200px) {
selector {
}
}</code>
</pre>
</li>
<li class="fragment">Targeting device orientation and/or viewport size:
<pre class="css">
<code>@media screen and (orientation: landscape) and (max-device-width: 1024px) {
selector {
}
}</code>
</pre>
<p><small>The alternative to <em>landscape</em> is <em>portrait</em></small></p>
</li>
</ol>
</section>
<section>
<h3>Other Media Queries</h3>
<ol start="3">
<li class="fragment">Targeting devices between viewport sizes:
<pre class="css">
<code>@media screen and (min-device-width: 320px) and (max-device-width: 480px) {
selector {
}
}</code>
</pre>
</li>
<li class="fragment">Styling on-paper printed pages:
<pre class="css">
<code>@media print {
selector {
}
}</code>
</pre>
</li>
</ol>
</section>
<!-- Questions -->
<section class="hide-pdf">
<h3>Questions?</h3>
<div style="font-size:1200%; line-height:1; height:100%;" class="blue">?
<div class="clear"></div>
</div>
</section>
</div>
<footer>
<div class="copyright">
Intermediate HTML & CSS | Burlington Chapter |
<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 async src="//assets.codepen.io/assets/embed/ei.js"></script>
<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>