-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathclass2.html
More file actions
1035 lines (947 loc) · 28.1 KB
/
class2.html
File metadata and controls
1035 lines (947 loc) · 28.1 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
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!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 2</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 2</h3>
</section>
<!-- Course Agenda / Topics / Course Outline -->
<section>
<h3>Class Agenda</h3>
<ul>
<li>Overlapping Elements</li>
<li>Name-based Placement</li>
<li>CSS Grid and Media Queries</li>
<li>Explicit and Implicit Grid</li>
<li>Sizing Implicit Tracks</li>
<li>Demos and Practice</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 -->
<!---->
<!---->
<!-- Quiz / Class 1 Review -->
<section>
<h3>Class 1 Review</h3>
<h3>Quiz Time!</h3>
<h4>🤔 🧠 💡 💯</h4>
</section>
<!-- Question 1 -->
<section>
<h4>Question 1</h4>
<h4 class="width-800 mb-16">
CSS Grid can only be used for two-dimensional layout
</h4>
<ul>
<li>True</li>
<li>False</li>
</ul>
<h4 class="fragment mt-16 highlight--black">False</h4>
</section>
<!-- Question 2 -->
<section>
<h4>Question 2</h4>
<h4 class="width-800 mb-16">
Declaring <code>display:grid</code> on an element creates a grid container
</h4>
<ul>
<li>True</li>
<li>False</li>
</ul>
<h4 class="fragment mt-16 highlight--black">True</h4>
</section>
<!-- Question 3 -->
<section>
<h4>Question 3</h4>
<h4 class="mb-16">Columns and rows created with grid are called:</h4>
<ul>
<li>Cells</li>
<li>Tracks</li>
<li>Gutters</li>
</ul>
<h4 class="fragment mt-16 highlight--black">Tracks</h4>
</section>
<!-- Question 4 -->
<section>
<h4>Question 4</h4>
<h4 class="width-800 mb-16">
Fractional (<code>fr</code>) units can be mixed with other units (<code
>px, rem, %</code
>)
</h4>
<ul>
<li>True</li>
<li>False</li>
</ul>
<h4 class="fragment mt-16 highlight--black">True</h4>
</section>
<!-- Question 5 -->
<section>
<h4>Question 5</h4>
<h4 class="width-800 mb-16">
Which declaration will create a grid of 10 columns where every other column
takes up as much space as it needs?
</h4>
<ol class="fs-28">
<li><code>grid-template-columns: repeat(10, 1fr) auto;</code></li>
<li><code>grid-template-columns: repeat(5, 1fr auto);</code></li>
<li><code>grid-template-columns: repeat(10, 1fr auto);</code></li>
</ol>
<h5 class="fragment mt-16 highlight--black">
<code>2. grid-template-columns: repeat(5, 1fr auto);</code>
</h5>
</section>
<!-- Results -->
<section>
<h3>How did you do? 😅 💯</h3>
</section>
<!-- Overlapping or Stacking Elements -->
<section>
<h3>Overlapping or Stacking Elements</h3>
</section>
<!-- Overlapping Grid Items -->
<section>
<h4>Overlapping Grid Items</h4>
<p class="fs-28 width-800">
Grid items can be positioned to occupy the same cell or track spaces--creating
an overlapping or stacking effect
</p>
</section>
<!-- Demo: Original State -->
<section>
<h4>Original State</h4>
<pre>
<code class="css">
.item1 {
grid-column: 2 / 5;
grid-row: 2 / 4;
}
.item7 {
grid-column: 1;
grid-row: 1 / span 4;
}
</code>
</pre>
<img
src="./images/grid-overlap-initial.png"
alt=""
width="550px" />
</section>
<!-- Demo: Overlapped State -->
<section>
<h4>Overlapped State</h4>
<pre>
<code class="css">
.item1 {
grid-column: 2 / 5;
grid-row: 2 / 4;
}
.item7 {
grid-column: 2; /* Shares same column line start as item1 */
grid-row: 3 / span 4;
}
</code>
</pre>
<img
src="./images/grid-overlap-end.png"
alt=""
width="550px" />
</section>
<!-- z-index -->
<section>
<h4>Controlling Overlaps with Z-Index</h4>
<p class="fs-28">
Use the <code class="highlight--yellow">z-index</code> property to control the
stacking order
</p>
<p class="mt-32">
Article:
<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/z-index">Z-Index</a>
(MDN Docs)
</p>
</section>
<!-- Demo: z-Index -->
<section>
<h4>Overlapped State with <code>z-index</code></h4>
<pre>
<code class="css">
.item1 {
grid-column: 2 / 5;
grid-row: 2 / 4;
z-index: 1;
}
.item7 {
grid-column: 2; /* Shares same column line start as item1 */
grid-row: 3 / span 4;
}
</code>
</pre>
<img
src="./images/grid-overlap-end-zIndex.png"
alt=""
width="550px" />
</section>
<!-- Hands-on Work -->
<section>
<h3>Let's Develop It!</h3>
<p>
<a
href="https://codepen.io/tinuola/full/BaOvbRe"
target="_blank"
>Codepen Sandbox
</a>
</p>
<p>
Clone or Fork:<br />
<code>Overlapping Exercise</code>
</p>
</section>
<!-- Finished Result -->
<section>
<h3>Finished Result</h3>
<img
src="./images/grid-overlap-exercise-result.png"
alt="" />
</section>
<!-- Grid Area -->
<section>
<h3>Grid Area</h3>
<p class="fs-28 width-750">
An alternative (and visual) way to size and place elements on a grid is to use
grid areas
</p>
</section>
<!-- Definition: Grid Area -->
<section>
<h3>Grid Area</h3>
<p class="width-800">
A <code class="highlight--yellow">grid area</code> is the total space
surrounded by four grid lines. It can contain any number of grid cells
</p>
<img
src="./images/grid-track-cell-area.png"
alt=""
width="375px" />
<div>
<small
>Image Credit:
<a
href="https://uploads.sitepoint.com/wp-content/uploads/2016/04/1461911969celltrackarea.jpg"
target="_blank"
>SitePoint.com</a
></small
>
</div>
</section>
<!-- Name-based Sizing & Placement -->
<section>
<h4>Name-Based Sizing & Placement</h4>
<p class="fs-28 width-750">
Areas of the grid can be given specific names that can then be applied to grid
items
</p>
</section>
<!-- grid-template-areas Syntax -->
<section>
<h4><code>grid-template-areas</code></h4>
<ul class="fs-28">
<li>
The <code>grid-template-areas</code> property is declared on the grid
container and accepts one or more string values (enclosed in quotes)
</li>
<li>Each string sequence represents a row</li>
<li>Each word represents a column cell</li>
</ul>
<pre>
<code class="css">
.container {
display: grid;
grid-template-areas:
'logo menu menu menu'
'hero hero hero hero'
'sidebar content content content'
'gallery gallery gallery gallery '
'footer footer footer footer';
}
</code>
</pre>
</section>
<!-- grid-area Syntax -->
<section>
<h4><code>grid-area</code></h4>
<p class="width-750 fs-28">
Grid items are then placed or positioned into the layout using the
<code>grid-area</code> property and referencing the named areas
</p>
<pre>
<code class="css">
.item1 {
grid-area: logo;
}
.item3 {
grid-area: hero
}
...
</code>
</pre>
</section>
<!-- Visual -->
<section>
<div class="flex-container">
<div class="flex-item">
<pre>
<code class="css">
.container {
display: grid;
grid-template-areas:
'logo menu menu menu'
'hero hero hero hero'
'sidebar content content content'
'gallery gallery gallery gallery '
'footer footer footer footer';
}
</code>
</pre>
</div>
<div class="flex-item">
<pre>
<code class="css">
.item1 {
grid-area: logo;
}
.item3 {
grid-area: hero
}
...
</code>
</pre>
</div>
</div>
<img
src="./images/grid-named-areas.png"
width="600px"
alt="" />
</section>
<!-- Creating empty space in named areas -->
<section>
<h4>Creating Empty Space</h4>
<p class="width-800 fs-28">
To leave a cell blank or create empty space, insert a period (<code
class="highlight--yellow"
>.</code
>) into the desired area in the grid
</p>
<pre>
<code class="css">
.container {
display: grid;
grid-template-areas:
'logo . menu menu'
'hero hero hero hero'
'sidebar content content content'
'gallery gallery gallery gallery '
'footer footer footer footer';
}
</code>
</pre>
</section>
<!-- Code & Visual: Creating empty space in named areas -->
<section>
<pre>
<code class="css">
.container {
display: grid;
grid-template-areas:
'logo . menu menu'
'hero hero hero hero'
'sidebar content content content'
'gallery gallery gallery gallery '
'footer footer footer footer';
}
</code>
</pre>
<img
src="./images/grid-named-areas-blank.png"
alt=""
width="750px" />
</section>
<!-- Specific column and row sizing -->
<section>
<h4>Track Sizing and Named Areas</h4>
<p class="fs-28 width-800">
More specific sizing can still be declared or combined with
<code>grid-template-areas</code>
</p>
<pre>
<code class="css">
.container {
display: grid;
/* Setting height for visual/illustrative effect */
height: 100vh;
/* Adding specific track dimensions */
grid-template-columns: 100px 1fr 1fr auto;
grid-template-rows: auto 250px 50vh 150px auto;
grid-template-areas:
'logo menu menu menu'
'hero hero hero hero'
'sidebar content content content'
'gallery gallery gallery gallery '
'footer footer footer footer';
}
</code>
</pre>
</section>
<!-- Visual: grid-area and track sizing -->
<section>
<h4>Track Sizing and Named Areas</h4>
<img
src="./images/grid-area-and-track-sizing.png"
width="500px"
alt="" />
</section>
<!-- grid-area and Line Numbers -->
<section>
<h4><code>grid-area</code> and Line Numbers</h4>
<p class="fs-28 width-900">
The <code>grid-area</code> property can also be used with grid line numbers
</p>
<pre>
<code class="css">
.item1 {
grid-area: 1 / 3 / 2 / 4
}
/* The values correspond to:
grid-row-start
grid-column-start
grid-row-end
grid-column-end
*/
</code>
</pre>
</section>
<!-- Overlapping Named Areas-->
<section>
<h4>Overlapping and Named Areas</h4>
<p class="width-900 fs-28 mb-32">
With named areas, only one name can be assigned to a cell
</p>
<p class="width-800 fs-28">
To create an overlap effect, use line numbers with either
<code>grid-area</code>, <code>grid-column</code> or <code>grid-row</code>
</p>
</section>
<!-- Code and Visual: Overlaping Named Area -->
<section>
<pre>
<code class="css">
.item2 {
background: whitesmoke;
/* grid-area: menu; */
/* To create overlap */
grid-row: 2;
grid-column: 3 / 5;
z-index: 1;
/* Or can be written as: */
/* grid-area: 2 / 3 / 3 / 5; */
}
</code>
</pre>
<img
src="./images/grid-area-overlapping.png"
width="500px"
alt="" />
</section>
<!-- Hands-on Work -->
<section>
<h3>Let's Develop It!</h3>
<p>
<a
href="https://codepen.io/tinuola/full/BaOvbRe"
target="_blank"
>Codepen Sandbox
</a>
</p>
<p>
Clone or Fork:<br />
<code>Named Areas Exercise</code>
</p>
</section>
<!-- Finished Result -->
<section>
<h3>Finished Result</h3>
<img
src="./images/frontend-mentor-testimonials-grid-results.png"
alt="" />
</section>
<!-- Responsive Grid with Media Queries -->
<section>
<h4>CSS Grid and Media Queries</h4>
<p class="fs-28 width-800">
Media queries can be used with CSS Grid to alter page layout as screen sizes
change
</p>
<pre>
<code class="css">
/* At tablet, resize to 2 columns */
/* Change the placement of items */
@media (max-width: 900px) {
.container {
grid-template-areas:
'logo menu'
'hero content'
'sidebar gallery'
'footer footer';
}
}
/* At mobile, resize to 1 column */
@media (max-width: 600px) {
.container {
grid-template-areas:
'logo'
'menu'
'hero'
'content'
'sidebar'
'gallery'
'footer';
}
}
</code>
</pre>
</section>
<!-- Responsive Grid with Media Queries -->
<section>
<h4>CSS Grid and Media Queries</h4>
<img
src="./images/responsive-tablet.png"
width="600px"
alt="" /><br />
<img
src="./images/responsive-mobile.png"
height="300px"
alt="" />
</section>
<!-- Hands-on Work -->
<section>
<h3>Let's Develop It!</h3>
<p class="width-800 mb-16">
Let's make the <code>Named Areas</code> layout exercise responsive!
</p>
<p>
<a
href="https://codepen.io/tinuola/full/BaOvbRe"
target="_blank"
>Codepen Sandbox
</a>
</p>
</section>
<!-- Exercise Instructions -->
<section>
<h4>Exercise Instructions</h4>
<ul class="fs-28">
<li>
Create media queries to change the layout to 2 columns at tablet size and 1
column at mobile size
</li>
<li>
At tablet size, <code>Daniel</code> and <code>Jonathan</code> should share a
row; <code>Jeanette</code> and <code>Patrick</code> should share a row
</li>
<li>
At mobile size, they each have their own row; and the row height is only as
high as the content
</li>
</ul>
</section>
<!-- Finished Result: Tablet -->
<section>
<h4>Finished Result: Tablet</h4>
<img
src="./images/responsive-exe-tablet-result.png"
alt="" />
</section>
<!-- Finished Result: Mobile -->
<section>
<h4>Finished Result: Mobile</h4>
<img
src="./images/responsive-exe-mobile-result.png"
alt="" />
</section>
<!-- Explicit Grid -->
<section>
<h4>Explicit Grid</h4>
<p
class="width-800"
style="font-size: 28px">
When a grid is created with a specfic number of columns and/or rows, it is
called an <code class="highlight--yellow">explicit grid</code> and has
explicit columns and rows
</p>
<pre>
<code class="html">
<div class="container">
<div class="item item1">1</div>
<div class="item item2">2</div>
<div class="item item3">3</div>
<div class="item item4">4</div>
</div>
</code>
</pre>
<pre>
<code class="css">
/* Creates an explicit 2 x 2 grid */
.container {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 100px 100px;
}
</code>
</pre>
</section>
<!-- Visual: Explicit Grid -->
<section>
<h4>Explicit Grid</h4>
<img
src="./images/explicit-grid.png"
alt="" />
</section>
<!-- Implicit Grid -->
<section>
<h4>Implicit Grid</h4>
<p
class="width-800"
style="font-size: 28px">
When a grid has more grid items than cells, it will automatically add new
tracks to accommodate the extra items, and create what's known as an
<code class="highlight--yellow">implicit grid</code> that has implicit tracks
</p>
<pre>
<code class="html">
<div class="container">
<div class="item item1">1</div>
<div class="item item2">2</div>
... <!-- Adding 10 more items-->
<div class="item item13">13</div>
<div class="item item14">14</div>
</div>
</code>
</pre>
<pre>
<code class="css">
/* Notice that the CSS hasn't changed... */
.container {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 100px 100px;
}
</code>
</pre>
</section>
<!-- Visual: Implicit Grid -->
<section>
<h4>Implicit Grid: Rows</h4>
<img
src="./images/implicit-grid.png"
width="800px"
alt="" />
</section>
<!-- Auto Placement -->
<section>
<h4>Auto Placement</h4>
<p
class="width-900"
style="font-size: 28px">
The implicit grid is controlled by CSS Grid's
<code>auto placement </code>algorithm which by default creates extra row
tracks when there are more items than cells explicitly defined
</p>
</section>
<!-- grid-auto-flow -->
<section>
<h4><code>grid-auto-flow</code></h4>
<p class="width-800 fs-28 mb-32">
CSS Grid's ability to create extra tracks is defined by the
<code class="highlight--yellow">grid-auto-flow</code> property
</p>
<p class="width-800 fs-28">
When we have more grid items than cells, by using
<code>grid-auto-flow</code> we can tell the browser to create extra tracks as
either rows (the default) or columns
</p>
</section>
<!-- grid-auto-flow: columns -->
<section>
<h4><code>grid-auto-flow</code></h4>
<p class="fs-28 width-600">
By default, <code>grid-auto-flow</code> is set to <code>row</code>, but can be
set to <code>column</code>
</p>
<pre>
<code class="css">
.container {
display: grid;
/* Explicitly create a 2x2 grid */
grid-template-columns: 1fr 1fr;
grid-template-rows: 100px 100px;
grid-auto-flow: column;
/* Make extra columns if there are more
items than can fit the explicit grid */
/* grid-auto-flow: row; is the default setting */
}
</code>
</pre>
</section>
<!-- Visual: grid-auto-flow: column -->
<section>
<h4>Implicit Grid: Columns</h4>
<img
src="./images/implicit-grid-columns.png"
width="800px"
alt="" />
</section>
<!-- Sizing Implicit Tracks -->
<section>
<h4>Sizing Implicit Tracks</h4>
<p class="width-800 fs-28">
We can define the sizing of implicit columns and rows by using
<code>grid-auto-columns</code> and <code>grid-auto-rows</code>
</p>
</section>
<!-- grid-auto columns -->
<!-- grid-auto-rows -->
<section>
<h4><code>grid-auto-columns</code></h4>
<h4><code>grid-auto-rows</code></h4>
<pre>
<code class="css">
.container {
display: grid;
/* Explicitly create a 2x2 grid */
grid-template-columns: 1fr 1fr;
grid-template-rows: 100px 100px;
grid-auto-flow: column;
grid-auto-columns: 100px;
/* Make every implicit/extra column 100px */
/*
grid-auto-rows: 200px;
Sets height for implicit rows
*/
}
</code>
</pre>
</section>
<!-- Visual: Implicit Columns -->
<section>
<h4>Sized Implicit Columns</h4>
<img
src="./images/implicit-grid-columns-sizing.png"
alt="" />
</section>
<!-- grid-auto-flow: dense -->
<section>
<h4><code>grid-auto-flow: dense</code></h4>
<p class="width-800 fs-28">
CSS Grid has the ability to fill up blank spaces that are left after explicit
placement
</p>
<p class="width-800 fs-28 mt-16">
Caveat: Only use <code>dense</code> if the order in which blank spaces are
filled is
<code class="highlight--yellow">not important</code>
</p>
<pre>
<code class="css">
.container {
display: grid;
grid-template-columns: repeat(4, 1fr 2fr);
grid-template-rows: repeat(10, 50px);
gap: 0.5rem;
grid-auto-flow: dense;
}
</code>
</pre>
</section>
<!-- Before applying dense -->
<section>
<h3>Before <code>dense</code></h3>
<img
src="./images/grid-auto-flow-dense-before.png"
alt="" />
</section>
<!-- After applying dense -->
<section>
<h3>After <code>dense</code></h3>
<img
src="./images/grid-auto-flow-dense-after.png"
alt="" />
</section>
<!-- Hands-on Work -->
<section>
<h3>Let's Develop It!</h3>
<p>
<a
href="https://codepen.io/tinuola/full/BaOvbRe"
target="_blank"
>Codepen Sandbox
</a>
</p>
<p class="fs-28 mb-32">
Clone or Fork:<br />
<code>Implicit Sizing: Student's Choice!</code>
</p>
<p class="fs-28 width-750">
Come up with your own grid and practice implicit sizing with
<code>grid-auto-flow</code> and the values/properties you've just learned
</p>
</section>
<!-- Resources -->
<section>
<h3>Resources</h3>
<div class="width-900">
<p>
<a
href="https://www.builder.io/blog/css-grid-template-areas"
target="_blank"
rel="noopener noreferrer"
>Become a CSS Grid wizard with grid-template-areas</a
>
</p>
</div>
</section>
<!-- OPTIONAL: Next Class and Topics -->
<section>
<h3>Class 3</h3>
<ul>
<li>Sizing with <code>minmax()</code></li>
<li>Sizing with <code>auto-fit</code> and <code>auto-fill</code></li>
<li>Combining CSS Grid and Flexbox</li>
<li>Common Layout Solutions with Grid</li>
<li>Demos and Practice</li>
</ul>
</section>
<!-- OPTIONAL: Showcase Student Work -->
<!-- <section>
<h2>Share What You've Built!</h2>
</section> -->
<!-- MUST-USE SLIDE -->
<!-- Add Course Survey Link -->
<section>
<h2>Give Us Your Feedback</h2>
<h3>
<a
href="https://forms.gle/Y1nbJ79JqJThYM9z6"
target="_blank"
>Survey Link</a
>
</h3>
</section>
<!-- Q&A -->
<section>
<h2>Q&A</h2>
</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>