-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathclass3.html
More file actions
719 lines (662 loc) · 21.2 KB
/
class3.html
File metadata and controls
719 lines (662 loc) · 21.2 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
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta
name="description"
content="Girl Develop It framework for easily creating beautiful presentations using HTML in GDI theme. Based on Hakim El Hattab's reveal.js" />
<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" />
<!-- Update with GDI Course Name -->
<title>CSS Grid Basics - Class 3</title>
<link
rel="icon"
type="image/x-icon"
href="../shared-assets/imgs/favicon.ico" />
<!-- RevealJS CDN -->
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/reveal.js@4.1.0/dist/reset.css" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/reveal.js@4.1.0/dist/reveal.css" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/reveal.js@4.1.0/dist/theme/simple.css"
id="theme" />
<!-- GDI Custom Theme -->
<link
rel="stylesheet"
href="../shared-assets/css/gdi-theme.css" />
<!-- Theme used for syntax highlighted code -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.1.0/styles/monokai.min.css" />
<!-- Course Custom Styles if Applicable-->
<link
rel="stylesheet"
href="./css/style.css" />
</head>
<body>
<div class="reveal">
<!-- Start of Slides container -->
<!-- A section element is displayed as a single slide -->
<!-- Do Not Delete slide instructions -->
<!---->
<!---->
<div class="slides">
<!-- Course Title -->
<section>
<h2>CSS Grid Basics</h2>
<h3>Class 3</h3>
</section>
<!-- Course Agenda / Topics / Course Outline -->
<section>
<h3>Class Agenda</h3>
<ul>
<li>Sizing with <code>minmax()</code></li>
<li>Sizing with <code>auto-fit</code> and <code>auto-fill</code></li>
<li>Layout Solutions with Grid <em>(CodePens)</em></li>
<li>Nesting Grid<em>(CodePen)</em></li>
<li>Combining CSS Grid and Flexbox</li>
<li>Final Project: Pet Gallery</li>
</ul>
</section>
<!-- Break -->
<section>
<h3>Break</h3>
<p>7p EST / 6p CST / 4p PST</p>
</section>
<!-- Course Slides -->
<!-- Create as many new sections (slides) as needed -->
<!---->
<!---->
<!-- Sizing Function Keywords -->
<section>
<h3>Sizing Function & Keywords</h3>
</section>
<!-- minmax -->
<section>
<h4><code>minmax()</code></h4>
<p class="width-800 fs-28 mb-32">
To set a minimum and maximum size for tracks, use the
<code>minmax()</code> function
</p>
<p class="fs-28"><code>minmax(min value, max value)</code></p>
<pre>
<code class="css">
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
/* grid-template-rows: 100px; */
/* What happens if content is more than 100px?
It will result in an overflow. */
grid-template-rows: minmax(100px, auto);
/* Set row to be at least 100px high, but
just in case, set a max value of auto to
take up as much height as needed! */
}
</code>
</pre>
</section>
<!-- Visual: With and Without minmax -->
<section>
<h4>Before <code>minmax()</code></h4>
<img
src="./images/grid-overflow.png"
alt="" />
<h4>After <code>minmax()</code></h4>
<img
src="./images/grid-overflow-minmax-fix.png"
alt="" />
</section>
<!-- minmax and Auto Placement -->
<section>
<h4><code>minmax</code> and Auto Placement</h4>
<p class="fs-28 width-800">
<code>minmax()</code> is especially useful with the
<code>grid-auto-rows</code> and
<code>grid-auto-columns</code> properties--when the number of extra tracks
that the grid might create is unknown AND also if the content these tracks
will hold is also unknown
</p>
</section>
<!-- Code: mimmax and Auto Placement -->
<section>
<h4><code>minmax</code> and Auto Placement</h4>
<pre>
<code class="css">
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: minmax(100px, auto);
/* grid-auto-rows: 50px; */
/* What happens if content is taller than 50px?! */
/* Just to be prepared... */
grid-auto-rows: minmax(50px, 1fr);
}
</code>
</pre>
</section>
<!-- Visual: mimmax and Auto Placement -->
<section>
<h4>Before <code>minmax()</code></h4>
<img
src="./images/minmax-auto-placement-BEFORE.png"
alt="" />
<h4>After <code>minmax()</code></h4>
<img
src="./images/minmax-auto-placement-AFTER.png"
alt="" />
</section>
<!-- Intro: auto-fit and auto-fill-->
<section>
<h4><code>auto-fit</code> and <code>auto-fill</code></h4>
<p class="fs-28 width-800">
<code class="highlight--yellow">auto-fit</code> and
<code class="highlight--yellow">auto-fill</code> are auto placement keywords
that when combined with the
<code class="highlight--yellow">repeat()</code> function can determine how to
size and arrange extra columns
</p>
</section>
<!-- Definitions: auto-fit and auto-fill-->
<section>
<h4><code>auto-fit</code> and <code>auto-fill</code></h4>
<p class="fs-28 width-800 mb-32">
<code>auto-fit</code> will fit whatever columns are available and
<code class="highlight--yellow">expand</code> them to avoid creating empty
space
</p>
<p class="fs-28 width-800">
<code>auto-fill</code> will do the same
<span class="highlight--yellow">EXCEPT leave empty space</span> if there are
not enough columns
</p>
</section>
<!-- Code & Visual: BEFORE auto-fit / auto-fill -->
<section>
<h4>Before <code>auto-fit</code> and <code>auto-fill</code></h4>
<pre>
<code class="css">
.container {
display: grid;
grid-template-columns: repeat(12, 200px);
/* Creates an overflow */
}
</code>
</pre>
<img
src="./images/auto-fit-auto-fill-BEFORE.png"
alt="" />
</section>
<!-- Code & Visual: AFTER auto-fit / auto-fill -->
<section>
<h4>After <code>auto-fit</code> and <code>auto-fill</code></h4>
<pre>
<code class="css">
.container {
display: grid;
grid-template-columns: repeat(auto-fit, 200px);
/* OR */
grid-template-columns: repeat(auto-fiil, 200px);
}
</code>
</pre>
<img
src="./images/auto-fit-auto-fill-AFTER.png"
alt=""
width="600px" />
</section>
<!-- Definitions: auto-fit and auto-fill-->
<section>
<h4><code>auto-fit</code> and <code>auto-fill</code></h4>
<p class="fs-28 width-800 mb-32">
<code>auto-fit</code> and <code>auto-fill</code> tell the browser to size
columns wide enough to fit or fill the given space, and then wrap whatever's
left to prevent an overflow
</p>
<p class="fs-28 width-800 mb-32">
In practice, they often end up achieving the same result
</p>
<div>
<p class="fs-24">
<a
href="https://css-tricks.com/auto-sizing-columns-css-grid-auto-fill-vs-auto-fit/"
target="_blank"
rel="noopener noreferrer"
>Auto-Sizing Columns in CSS Grid: `auto-fill` vs `auto-fit`</a
>
(CSS Tricks)
</p>
</div>
</section>
<!-- Flexible grid with minmax
and auto-fit / auto-fill -->
<section>
<h4 class="width-900 mb-16">
Flexible Grids with <code>minmax()</code> and keywords!
</h4>
<p class="fs-28 width-800 mb-32">
When <code>minmax()</code> is combined with <code>auto-fit</code> or
<code>auto-fill</code>, the result is a flexible grid--without media queries!
🤯 🤯 🤯
</p>
<div class="mt-32">
<p class="fs-24">
This is considered to be the
<a
href="https://css-tricks.com/books/greatest-css-tricks/flexible-grids/"
target="_blank"
>greatest CSS Grid Trick of all time!</a
>
</p>
</div>
</section>
<!-- Flexible Grid -->
<section>
<h4>Responsive Grid -- No Media Queries!</h4>
<pre>
<code class="css">
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
/* Or use auto-fill -- the effect is the same */
}
</code>
</pre>
<img
src="./images/flexible-grid.gif"
alt=""
width="600px" />
</section>
<!-- What Other Cool Things Can Grid Do? -->
<section>
<h3>A Few Cool Things CSS Grid Can Do</h3>
</section>
<!-- Sticky Footer -->
<section>
<h4>Sticky Footer</h4>
<img
src="./images/grid-trick-sticky-footer.png"
alt="" />
<div>
<p class="fs-28">
<a
href="https://codepen.io/tinuola/pen/RwYzrLy"
target="_blank"
>CodePen Demo</a
>
</p>
</div>
</section>
<!-- Horizontal and Vertical Centering -->
<section>
<h4>Horizontal and Vertical Centering</h4>
<img
src="./images/grid-trick-centering.png"
alt="" />
<div>
<p class="fs-28">
<a
href="https://codepen.io/tinuola/pen/YzOowjv"
target="_blank"
>CodePen Demo</a
>
</p>
<p class="fs-28">
<a
href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Alignment"
target="_blank"
>CSS Box Alignment Properties</a
>
</p>
</div>
</section>
<!-- Nested Grids -->
<section>
<h4>Nested Grids</h4>
<img
src="./images/nested-grids.png"
alt="" />
<div>
<p class="fs-28">
<a
href="https://codepen.io/tinuola/pen/eYLwJog"
target="_blank"
>CodePen Demo</a
>
</p>
</div>
</section>
<!-- CSS Flexbox + CSS Grid -->
<section>
<h4>Flexbox and Grid</h4>
<p class="fs-28 width-800 mb-32">
Another example of nesting is to pair CSS Flexbox and CSS Grid together!
</p>
<p class="fs-28 width-800 mb-32">
A typical use case is to create the main structure of a page with CSS Grid,
and then apply CSS Flexbox to the contents of the grid items
</p>
<p class="fs-28 width-800 mb-32">
Note: Grid does not have to be applied to an entire page; it can be applied to
sections of a page
</p>
</section>
<!-- Visual Examples -->
<section>
<img
src="./images/flex-and-grid-combo1.png"
alt="" />
<div>
<p class="fs-24">
<a
href="https://nostrongbeliefs.com/blog/using-css-grid-and-flexbox-together/"
target="_blank"
rel="noopener noreferrer"
>Using CSS Grid and Flexbox Together</a
>
(NoStrongBeliefs)
</p>
<p class="fs-24">
<a
href="https://codepen.io/derekjohnson/pen/BVWPRV"
target="_blank"
rel="noopener noreferrer"
>CodePen</a
>
</p>
</div>
</section>
<section>
<img
src="./images/flex-and-grid-combo2.jpeg"
alt="" />
<div>
<p class="fs-24">
<a
href="https://www.siteinspire.com/websites/7202-accurat"
target="_blank"
>Site Inspire: Accurat</a
>
</p>
</div>
</section>
<section>
<img
src="./images/flex-and-grid-combo3.jpeg"
alt="" />
<div>
<p class="fs-24">
<a
href="https://www.siteinspire.com/websites/4423-fibb"
target="_blank"
>Site Inspire: Fibb</a
>
</p>
</div>
</section>
<section>
<img
src="./images/flex-and-grid-combo4.jpeg"
alt="" />
<div>
<p class="fs-24">
<a
href="https://www.siteinspire.com/websites/9882-honk"
target="_blank"
>Site Inspire: Honk</a
>
</p>
</div>
</section>
<section>
<img
src="./images/flex-and-grid-combo5.jpeg"
alt="" />
<div>
<p class="fs-24">
<a
href="https://www.siteinspire.com/websites/11469-works-in-progress"
target="_blank"
>Site Inspire: Works in Progress</a
>
</p>
</div>
</section>
<!-- Final Project -->
<section>
<h3>Let's Develop It!</h3>
<h4>Final Project</h4>
<p class="fs-28">
<a
href="https://codepen.io/tinuola/full/BaOvbRe"
target="_blank"
>Codepen Sandbox
</a>
</p>
<p class="fs-28 mb-32">Clone or Fork: <code>Final Project</code></p>
</section>
<!-- Instructions -->
<section>
<h3>Instructions</h3>
<h4>Student's Choice!</h4>
<p class="fs-28">Create the gallery grid however you want!</p>
<p class="fs-28">Or model the sample finished version</p>
</section>
<!-- Finished Result -->
<section>
<h4>Possible Finished Result</h4>
<img
src="./images/pet-gallery-project-END-v1.png"
alt="" />
</section>
<!-- OPTIONAL: Showcase Student Work -->
<section>
<h3>Share What You've Built!</h3>
</section>
<!-- You Did It! -->
<section>
<h3>You did it!</h3>
<img
src="../shared-assets/imgs/stock-img/celebration_clay-banks-unsplash.jpg"
alt="Woman celebrating" />
<div>
<small
>Photo credit:
<a
href="https://unsplash.com/@claybanks"
target="_blank"
>Clay Banks</a
>
<a
href="http://creativecommons.org/licenses/by-sa/2.0/"
target="_blank"
>cc</a
>
</small>
</div>
</section>
<!-- Resources -->
<section>
<h4>Additional Resources for Learning & Practice</h4>
<div class="width-900">
<p class="fs-24">
<a
href="https://codepip.com/games/grid-garden/"
target="_blank"
rel="noopener noreferrer"
>CSS Grid Garden</a
>
</p>
<p class="fs-24">
<a
href="https://learncssgrid.com/"
target="_blank"
rel="noopener noreferrer"
>Learn CSS Grid</a
>
</p>
<p class="fs-24">
<a
href="https://griddy.io/"
target="_blank"
>Griddy.io</a
>
(A Grid Sandbox)
</p>
<p class="fs-24">
<a
href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Grids"
target="_blank"
rel="noopener noreferrer"
>Any Tutorial on MDN</a
>
</p>
<p class="fs-24">
<a
href="https://css-tricks.com/snippets/css/complete-guide-grid/"
target="_blank"
rel="noopener noreferrer"
>CSS Tricks' Complete Guide to Grid</a
>
</p>
<p class="fs-24">
People:
<a
href="https://rachelandrew.co.uk/"
target="_blank"
rel="noopener noreferrer"
>Rachel Andrews</a
>,
<a
href="https://youtube.com/kevinpowell"
target="_blank"
rel="noopener noreferrer"
>Kevin Powell</a
>,
<a
href="https://jensimmons.com/"
target="_blank"
rel="noopener noreferrer"
>Jen Simmons</a
>
</p>
</div>
</section>
<!-- MUST-USE SLIDE -->
<!-- Add Course Survey Link -->
<section>
<h2>Give Us Your Feedback</h2>
<h3>
<a
href="https://forms.gle/2gEGeqYWKfVJ4fFcA"
target="_blank"
>Final Survey</a
>
</h3>
</section>
<!-- Q&A -->
<section>
<h2>Q&A</h2>
</section>
<!-- MUST-USE SLIDE -->
<!-- Promote Upcoming GDI Courses -->
<section>
<h3>Upcoming GDI Courses</h3>
<ul class="fs-32">
<li>Web Design Essentials 2</li>
<li>JavaScript: Intro to the DOM</li>
<li>Intro to CSS Animations</li>
</ul>
<p class="fs-28 mt-16">
<a
href="https://girldevelopit.com/events/#/list"
target="_blank"
rel="noopener noreferrer"
>GDI Classes and Events Calendar</a
>
</p>
</section>
<!-- Add Instructor and/or TA Contact -->
<section>
<h3>Keep in Touch</h3>
<p class="fs-28 mb-16">
<a
href="https://www.linkedin.com/in/tinuolaawopetu/"
target="_blank"
>https://www.linkedin.com/in/tinuolaawopetu/</a
>
</p>
<p class="fs-28">
<a
href="https://www.linkedin.com/in/annekatzeff/"
target="_blank"
>https://www.linkedin.com/in/annekatzeff/</a
>
</p>
<p class="fs-28">
<a
href="https://www.askdesign.biz/"
target="_blank"
rel="noopener noreferrer"
>www.askdesign.biz</a
>
</p>
</section>
<!-- Thank You -->
<section>
<img
src="../shared-assets/imgs/gdi-logos/gdi-logo_peach.png"
alt="GDI Logo"
width="300px"
class="noborder" />
<br />
<h2>Thank You!</h2>
</section>
</div>
<!-- End of Slides container -->
<!---->
<!---->
<!-- Update Footer with Course Name -->
<footer>
<div class="copyright">
<img
src="../shared-assets/imgs/gdi-logos/gdi-logo_peach.png"
alt="GDI Logo"
width="40px"
class="noborder" />
<p>CSS Grid Basics</p>
<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>
<!-- End of Reveal wrapper -->
<!---->
<!---->
<!-- RevealJS Scripts & Config - Do Not Edit or Delete -->
<script src="https://cdn.jsdelivr.net/npm/reveal.js@4.1.0/dist/reveal.js"></script>
<script src="https://cdn.jsdelivr.net/npm/reveal.js@4.1.0/plugin/highlight/highlight.js"></script>
<script src="https://cdn.jsdelivr.net/npm/highlightjs-badge@0.1.9/highlightjs-badge.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsPlumb/2.15.5/js/jsplumb.min.js"></script>
<script src="../shared-assets/js/revealConfig.js"></script>
</body>
</html>