-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
835 lines (809 loc) · 41.7 KB
/
index.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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Crafting With CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="main.css">
<link rel="stylesheet" type="text/css" href="box-model.css">
<link rel="stylesheet" type="text/css" href="specificity.css">
<link rel="stylesheet" type="text/css" href="flexbox.css">
<link rel="stylesheet" type="text/css" href="centering.css">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
</head>
<body>
<input type="radio" name="theme-selector" id="theme-default" checked>
<input type="radio" name="theme-selector" id="theme-dark">
<input type="radio" name="theme-selector" id="theme-gameboy">
<s id="s1"></s>
<s id="s2"></s>
<s id="s3"></s>
<s id="s4"></s>
<s id="s5"></s>
<s id="s6"></s>
<s id="s7"></s>
<s id="s8"></s>
<s id="s9"></s>
<s id="s10"></s>
<s id="s11"></s>
<nav>
<a href="#s1" data-tooltip="crafting with CSS"></a>
<a href="#s2" data-tooltip="HTML primer: familiar tags"></a>
<a href="#s3" data-tooltip="HTML primer: additional tags"></a>
<a href="#s4" data-tooltip="the box model"></a>
<a href="#s5" data-tooltip="cascading rules: specificity"></a>
<a href="#s6" data-tooltip="position"></a>
<a href="#s7" data-tooltip="z-index"></a>
<a href="#s8" data-tooltip="flexbox"></a>
<a href="#s9" data-tooltip="centering things"></a>
<a href="#s10" data-tooltip="CSS variables"></a>
<a href="#s11" data-tooltip="resources"></a>
<a href="https://github.com/a0js/crafting-css" data-tooltip="View Source" id="github-link"></a>
</nav>
<div class="prevNext">
<div>
<a href="">➲</a><a href="#s2">➲</a>
</div>
<div>
<a href="#s1">➲</a><a href="#s3">➲</a>
</div>
<div>
<a href="#s2">➲</a><a href="#s4">➲</a>
</div>
<div>
<a href="#s3">➲</a><a href="#s5">➲</a>
</div>
<div>
<a href="#s4">➲</a><a href="#s6">➲</a>
</div>
<div>
<a href="#s5">➲</a><a href="#s7">➲</a>
</div>
<div>
<a href="#s6">➲</a><a href="#s8">➲</a>
</div>
<div>
<a href="#s7">➲</a><a href="#s9">➲</a>
</div>
<div>
<a href="#s8">➲</a><a href="#s10">➲</a>
</div>
<div>
<a href="#s9">➲</a><a href="#s11">➲</a>
</div>
<div>
<a href="#s10">➲</a><a href="#s11">➲</a>
</div>
</div>
<main>
<section id="title" class="slide-layout-title">
<h1>
<img src="./icon-192x192.png" alt="crafting-css" />
<span>
crafting with CSS
<small>a pure CSS presentation</small>
</span>
</h1>
</section>
<section id="familiar-tags">
<h2>HTML primer: familiar tags</h2>
<div class="slide-content">
<section>
<h3>block elements</h3>
<ul>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div">
<code><div></code>
</a>
</li>
<li>
<a target="_blank"
href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements">
<code><h1>…<h6></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p">
<code><p></code>
</a>
</li>
</ul>
</section>
<section>
<h3>inline elements</h3>
<ul>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span">
<code><span></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a">
<code><a></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/image">
<code><image></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/b">
<code><b></code>
</a> or symantically
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strong">
<code><strong></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/i">
<code><i></code>
</a> or symantically
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em">
<code><em></code>
</a>
</li>
</ul>
</section>
<section>
<h3>other elements</h3>
<ul>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul">
<code><ul></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol">
<code><ol></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl">
<code><dl></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li">
<code><li></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dt">
<code><dt></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dd">
<code><dd></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table">
<code><table></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr">
<code><tr></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td">
<code><td></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th">
<code><th></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form">
<code><form></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">
<code><input></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select">
<code><input></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option">
<code><option></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label">
<code><label></code>
</a>,
<a target="_blank"
href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea">
<code><textarea></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button">
<code><button></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br">
<code><br></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr">
<code><hr></code>
</a>
</li>
</ul>
</section>
</div>
</section>
<section id="additional-tags">
<h2>HTML primer: additional tags</h2>
<div class="slide-content">
<section>
<h3>block elements</h3>
<ul>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section">
<code><section></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article">
<code><article></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main">
<code><main></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside">
<code><aside></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/nav">
<code><nav></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header">
<code><header></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/footer">
<code><footer></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre">
<code><pre></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/address">
<code><address></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/address">
<code><blockquote></code>
</a>
</li>
</ul>
</section>
<section>
<h3>inline elements</h3>
<ul>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code">
<code><code></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark">
<code><mark></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q">
<code><q></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/samp">
<code><samp></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/small">
<code><small></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/var">
<code><var></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub">
<code><sub></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup">
<code><sup></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/s">
<code><s></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/del">
<code><del></code>
</a>,
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ins">
<code><ins></code>
</a>
</li>
</ul>
</section>
<section>
<h3>other elements</h3>
<ul>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/output">
<code><output></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meter">
<code><meter></code>
</a>
</li>
<li>
<a target="_blank"
href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress">
<code><progress></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time">
<code><time></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio">
<code><audio></code>
</a>
</li>
<li>
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video">
<code><video></code>
</a>
</li>
</ul>
</section>
</div>
<p class="center">Moral of the Story: Pick the right element for your content!</p>
</section>
<section id="box-model">
<h2>the box model</h2>
<div class="slide-content">
<div class="explanation">
<ul>
<li>Width and height are set on the content.</li>
<li>Padding is the space between the content and the border.</li>
<li>Margin is the space between the border and external elements.</li>
<li>Notice margins collapse for vertically stacked elements.</li>
<li>
When <code>box-sizing: border-box;</code> you'll notice the width
and height set for the element now include padding and border
rather than just the content.
</li>
<li>
<code>outline:</code> is generally used to indicate focus and does not affect
the size of the element. To hide a focus outline on an already styled attribute,
you can put <code>outline:none;</code>.
</li>
</ul>
</div>
<div class="illustration">
<input type="checkbox" id="animate-box-sizing" />
<input type="checkbox" id="show-outline" />
<div class="box-model-example">
<div class="box-model-inner-div">
Inspect My Parent!
</div>
</div>
<div class="box-model-example">
<div class="box-model-inner-div">
box-sizing<br>content-box
</div>
</div>
<div class="box-model-example border-boxed">
<div class="box-model-inner-div">
box-sizing<br>border-box
</div>
</div>
<div class="box-model-buttons">
<label class="toggle-button" id="animate-box-sizing-label" for="animate-box-sizing"></label>
<label class="toggle-button" id="show-outline-label" for="show-outline"></label>
</div>
</div>
</div>
</section>
<section id="cascade-rules-specificity">
<h2>cascading rules: specificity</h2>
<p>When multiple rules match, specificity score is calculated based on the composition of the selectors.</p>
<div class="slide-content">
<input type="radio" name="specificity-example" id="specificity-example-1" checked>
<input type="radio" name="specificity-example" id="specificity-example-2">
<input type="radio" name="specificity-example" id="specificity-example-3">
<input type="radio" name="specificity-example" id="specificity-example-4">
<div class="explanation">
<table id="specificity-example-table">
<thead>
<tr>
<th>Selector Types</th>
<th>Instances in Example</th>
<th>Value per Instance</th>
<th>Total</th>
</tr>
</thead>
<tbody class="specificity-table-body">
<tr>
<td>Inline Style</td>
<td id="example-thousands"></td>
<td>1000</td>
<td><output name="thousands"></output></td>
</tr>
<tr>
<td>ID selectors</td>
<td id="example-hundreds"></td>
<td>100</td>
<td><output name="hundreds"></output></td>
</tr>
<tr>
<td>Class Selector, Attribute Selector, Pseudo-class Selector</td>
<td id="example-tens"></td>
<td>10</td>
<td><output name="tens"></output></td>
</tr>
<tr>
<td>Element Selector, Pseudo-element Selector</td>
<td id="example-ones"></td>
<td>1</td>
<td><output name="ones"></output></td>
</tr>
<tr>
<td colspan="3">Total Specificity</td>
<td style="color: white; background-color: black;"><output name="total"></output></td>
</tr>
</tbody>
</table>
<ul>
<li>In the event of tied specificity, the rule that comes last wins.</li>
<li>Adding <code>!important</code> to a declaration adds 10,000 to that specific property. It is like a sledge-hammer: effective, but messy. Only use when absolutely necessary.</li>
</ul>
</div>
<div class="specificity-buttons">
<h4>Click a rule to see it's score!</h4>
<label for="specificity-example-1"><pre><code>div table tbody tr td {
background-color: green;
}</code></pre></label>
<label for="specificity-example-2"><pre><code>.specificity-table-body td {
background-color: white;
color: red;
}</code></pre></label>
<label for="specificity-example-3"><pre><code>#specificity-example-table td {
color: black;
}</code></pre></label>
<label for="specificity-example-4"><pre><code><td style="color: white;
background-color: black;"></code></pre></label>
</div>
</div>
<p>Check out <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Cascade_and_inheritance#Specificity">MDN</a> for more information about specificity.</p>
</section>
<section id="position">
<h2>position</h2>
<div class="slide-content">
<dl>
<dt><code>static</code></dt>
<dd><em>Default</em> Places document in normal document flow</dd>
<dt><code>relative</code></dt>
<dd>Allows for changes in position <em>relative</em> to the static position. Static position is left in document flow.</dd>
<dt><code>absolute</code></dt>
<dd>Allows for changes in position relative to the closest ancestor not statically positioned. Static position is removed from the flow.</dd>
<dt><code>fixed</code></dt>
<dd>Allows for changes in position relative to the viewport. Static position is removed from the flow.</dd>
<dt><code>sticky</code></dt>
<dd>Hybrid of static and fixed. Static position until the element is at the top of the viewport, then fixed to the top of the viewport when scrolled past. Static position is left in document flow.</dd>
</dl>
</div>
</section>
<section id="z-index">
<h2>z-index</h2>
<div class="slide-content">
<ul>
<li>Z-Index represents an arbitrary depth level repsective to the current stacking context</li>
<li>A stacking context is created by several elements
<ul>
<li><code><html></code> or the root stacking context</li>
<li>Basically any element with <code>z-index: <em><integer></em></code></li>
<li>Element with <code>position: fixed | sticky</code></li>
<li>Element with <code>transform:</code> or <code>filter:</code> set</li>
</ul>
</li>
<li>Any child of one of these elements will only compare z-index with it's siblings</li>
<li>The heirarchy of stacking contexts is a subset of the DOM tree
<ul>
<li>An element's stacking context is determined by the closest ancestor with a stacking context</li>
</ul>
</li>
</ul>
</div>
</section>
<section id="flexbox">
<h2>flexbox</h2>
<input type="radio" name="align-items-example" id="align-items-stretch" checked>
<input type="radio" name="align-items-example" id="align-items-flex-start">
<input type="radio" name="align-items-example" id="align-items-center">
<input type="radio" name="align-items-example" id="align-items-flex-end">
<input type="radio" name="align-items-example" id="align-items-baseline">
<input type="radio" name="justify-content-example" id="justify-content-flex-start" checked>
<input type="radio" name="justify-content-example" id="justify-content-center">
<input type="radio" name="justify-content-example" id="justify-content-flex-end">
<input type="radio" name="justify-content-example" id="justify-content-space-around">
<input type="radio" name="justify-content-example" id="justify-content-space-between">
<input type="radio" name="justify-content-example" id="justify-content-space-evenly">
<input type="radio" name="flex-direction-example" id="flex-direction-row" checked>
<input type="radio" name="flex-direction-example" id="flex-direction-row-reverse">
<input type="radio" name="flex-direction-example" id="flex-direction-column">
<input type="radio" name="flex-direction-example" id="flex-direction-column-reverse">
<input type="radio" name="flex-wrap-example" id="flex-wrap-nowrap" checked>
<input type="radio" name="flex-wrap-example" id="flex-wrap-wrap">
<input type="radio" name="flex-wrap-example" id="flex-wrap-wrap-reverse">
<input type="radio" name="align-content-example" id="align-content-stretch" checked>
<input type="radio" name="align-content-example" id="align-content-flex-start">
<input type="radio" name="align-content-example" id="align-content-center">
<input type="radio" name="align-content-example" id="align-content-flex-end">
<input type="radio" name="align-content-example" id="align-content-space-around">
<input type="radio" name="align-content-example" id="align-content-space-between">
<input type="radio" name="order-example" id="order-zero" checked>
<input type="radio" name="order-example" id="order-negative-one">
<input type="radio" name="order-example" id="order-two">
<input type="radio" name="order-example" id="order-ninety-nine">
<input type="radio" name="flex-example" id="flex-zero-one-auto" checked>
<input type="radio" name="flex-example" id="flex-none">
<input type="radio" name="flex-example" id="flex-one">
<input type="radio" name="flex-example" id="flex-zero-one-twenty-percent">
<input type="radio" name="align-self-example" id="align-self-auto" checked>
<input type="radio" name="align-self-example" id="align-self-flex-start">
<input type="radio" name="align-self-example" id="align-self-center">
<input type="radio" name="align-self-example" id="align-self-stretch">
<input type="radio" name="align-self-example" id="align-self-flex-end">
<input type="radio" name="align-self-example" id="align-self-baseline">
<div class="slide-content">
<section>
<h3>Controlling Flex from Parent</h3>
<dl>
<dt><code>align-items:</code></dt>
<dd>
<label for="align-items-stretch"><code>stretch</code></label>
<label for="align-items-flex-start"><code>flex-start</code></label>
<label for="align-items-center"><code>center</code></label>
<label for="align-items-flex-end"><code>flex-end</code></label>
<label for="align-items-baseline"><code>baseline</code></label>
</dd>
<dt><code>justify-content:</code></dt>
<dd>
<label for="justify-content-flex-start"><code>flex-start</code></label>
<label for="justify-content-center"><code>center</code></label>
<label for="justify-content-flex-end"><code>flex-end</code></label>
<label for="justify-content-space-around"><code>space-around</code></label>
<label for="justify-content-space-between"><code>space-between</code></label>
<label for="justify-content-space-evenly"><code>space-evenly</code></label>
</dd>
<dt><code>flex-direction:</code></dt>
<dd>
<label for="flex-direction-row"><code>row</code></label>
<label for="flex-direction-row-reverse"><code>row-reverse</code></label>
<label for="flex-direction-column"><code>column</code></label>
<label for="flex-direction-column-reverse"><code>column-reverse</code></label>
</dd>
<dt><code>flex-wrap:</code></dt>
<dd>
<label for="flex-wrap-nowrap"><code>nowrap</code></label>
<label for="flex-wrap-wrap"><code>wrap</code></label>
<label for="flex-wrap-wrap-reverse"><code>wrap-reverse</code></label>
</dd>
<dt><code>align-content:</code></dt>
<dd>
<label for="align-content-stretch"><code>stretch</code></label>
<label for="align-content-flex-start"><code>flex-start</code></label>
<label for="align-content-center"><code>center</code></label>
<label for="align-content-flex-end"><code>flex-end</code></label>
<label for="align-content-space-around"><code>space-around</code></label>
<label for="align-content-space-between"><code>space-between</code></label>
</dd>
</dl>
</section>
<section>
<h3>Controlling Flex from Child</h3>
<dl>
<dt><code>order:<em><integer></em></code></dt>
<dd>
<label for="order-zero"><code>0</code></label>
<label for="order-negative-one"><code>-1</code></label>
<label for="order-two"><code>2</code></label>
<label for="order-ninety-nine"><code>99</code></label>
</dd>
<dt><code>flex:<em><flex-grow> <flex-shrink> <flex-basis></em></code></dt>
<dd>
<label for="flex-zero-one-auto"><code>0 1 auto</code></label>
<label for="flex-none"><code>none</code></label>
<label for="flex-one"><code>1</code></label>
<label for="flex-zero-one-twenty-percent"><code>0 1 20%</code></label>
</dd>
<dt><code>align-self:</code></dt>
<dd>
<label for="align-self-auto"><code>auto</code></label>
<label for="align-self-flex-start"><code>flex-start</code></label>
<label for="align-self-center"><code>center</code></label>
<label for="align-self-stretch"><code>stretch</code></label>
<label for="align-self-flex-end"><code>flex-end</code></label>
<label for="align-self-baseline"><code>baseline</code></label>
</dd>
</dl>
</section>
</div>
<div id="flexbox-example">
<div></div>
<div></div>
<div></div>
<div class="flexbox-example-child"></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div class="flexbox-example-child"></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<p>Every third box has a different <code>line-height</code> giving it a different baseline than the others.</p>
</section>
<section id="centering">
<h2>centering things</h2>
<div class="slide-content">
<section>
<h3>with flexbox</h3>
<pre><code>parent {
display:flex;
align-items: center;
justify-content: center;
}</code></pre>
<span>or</span>
<pre><code>parent {
display: flex;
}
child {
align-self: center;
justify-self: center;
}</code></pre>
</section>
<section>
<h3>with position</h3>
<pre><code>parent {
position: relative;
}
child {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}</code></pre>
</section>
<section>
<h3>with text-align</h3>
<pre><code>child {
white-space: nowrap;
height: 30px;
line-height: 30px;
/* heights must match */
text-align: center;
}</code></pre>
<p>Note: Only works on single line text in block element of defined height</p>
</section>
</div>
<p><code>vertical-align: middle;</code> only works on specific elements. You will only really use it on table cells.</p>
</section>
<section id="css-variables">
<h2>CSS variables</h2>
<div class="slide-content">
<section>
<h3>Themes on Root</h3>
<p>Select A Theme:</p>
<label for="theme-default"><code>default</code></label>
<label for="theme-dark"><code>dark mode</code></label>
<label for="theme-gameboy"><code>gameboy</code></label>
<section>
<label for="theme-default">
<pre><code>:root {
--code-background-color: hsla(0, 0%, 0%, 0.8);
--code-text-color: hsla(0, 0%, 100%, 0.9);
--code-text-font: 'Roboto Mono', monospace;
...
}</code></pre>
</label>
</section>
<section>
<label for="theme-dark">
<pre><code>:root[data-theme="dark"] {
--code-background-color: hsla(0, 0%, 0%, 0.8);
--code-text-color: hsla(0, 0%, 100%, 0.9);
...
}</code></pre>
</label>
</section>
<section>
<label for="theme-gameboy">
<pre><code>:root[data-theme="gameboy"] {
--code-background-color: hsl(159, 33%, 31%);
--code-text-color: hsl(200, 60%, 8%);
--code-text-font: 'VT323', monospace;
...
}</code></pre>
</label>
</section>
</section>
<section>
<h3>Applying the Theme</h3>
<pre><code>code {
background-color: var(--code-background-color);
color: var(--code-text-color);
font-family: var(--code-text-font);
}</code></pre>
<h3>Rules to Remember</h3>
<ul>
<li><code>:root</code> refers to the root of the document, in HTML, the <code><html></code> element</li>
<li>Setting a variable below the root will only be available on the element selected and its decendants</li>
<li>A CSS variable can contain an entire property value, or a partial value, e.g.:
<pre><code>--default-size: 5px;
main {
border: var(--default-size) solid #000;
}
</code></pre>
</li>
</ul>
</section>
</div>
</section>
<section id="resources">
<h2>resources</h2>
<div class="slide-content">
<ul>
<li>Highly recommend <a href="https://developer.mozilla.org/">MDN</a> for reference on specific elements and properties
<ul>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element">HTML Element Reference</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model">The Box Model</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Cascade_and_inheritance">Cascade and Inheritance</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context">The Stacking Context</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Grids">Grid Layout</a></li>
</ul>
</li>
<li><a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">CSS-Tricks Flexbox Guide</a> is fantastic</li>
<li>Check out <a href="https://codepen.io/rokobuljan/pen/XXzqKQ">Roko C. Buljan's Pen</a> to see how to do a pure css slideshow</li>
<li>Check out <a href="https://favicon.io">Favicon.io</a> to easily generate favicons and icons</li>
<li>Check out <a href="https://cssgradient.io/">CSSGradient.io</a> to help generate gradients for css rules</li>
</ul>
</div>
<p>Disclaimer: This presentation is entirely CSS, no javascript. Do I recommend that? No! Use the right tool for the right job. This exercise was done simply to show that you can do a lot with css.</p>
</section>
</main>
</body>
</html>