-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhtml-notes.html
1216 lines (1147 loc) · 54.6 KB
/
html-notes.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
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 lang="en">
<head>
<!-- 2021-05-08 Sat 23:18 -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Notes on HTML and related things</title>
<meta name="generator" content="Org mode">
<meta name="author" content="George Kontsevich">
<meta name="description" content="Notes on HTML and related things like CSS etc."
>
<link rel="stylesheet" type="text/css" href="../web/worg.css" />
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="./index.html"> UP </a>
|
<a accesskey="H" href="./index.html"> HOME </a>
</div><div id="content">
<h1 class="title">Notes on HTML and related things</h1>
<div id="outline-container-org4ffb40e" class="outline-2">
<h2 id="org4ffb40e">Intro</h2>
<div class="outline-text-2" id="text-org4ffb40e">
<p>
Private notes on HTML and CSS .. etc. <br>
Starting from the material <a href="https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML">provided by Mozilla</a>
</p>
</div>
</div>
<div id="outline-container-orgfd01796" class="outline-2">
<h2 id="orgfd01796">HTML</h2>
<div class="outline-text-2" id="text-orgfd01796">
</div>
<div id="outline-container-org684cf40" class="outline-3">
<h3 id="org684cf40">Opening</h3>
<div class="outline-text-3" id="text-org684cf40">
<p>
An <b>HTML</b> file starts with stating which standard it holds to. A minimal example that works is the following
</p>
<div class="org-src-container">
<pre class="src src-html"><span style="color: #8b2252;"><!DOCTYPE html></span>
</pre>
</div>
<p>
Next you declare the opening of the document. This wraps all the content
</p>
<div class="org-src-container">
<pre class="src src-html"><<span style="color: #0000ff;">html</span>>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgebe773a" class="outline-3">
<h3 id="orgebe773a">Head</h3>
<div class="outline-text-3" id="text-orgebe773a">
<p>
Next we open up the "head" which will contain info about the document - but things that aren't directly visible.<br>
Ex:<br>
</p>
<ul class="org-ul">
<li>The title that will show up at the top (as the tab name for instance)</li>
<li>Metadata:
<ul class="org-ul">
<li>The character set used by the webpage</li>
<li>The author</li>
<li>Other stuff for OpenGraph/Twitter etc. see: <a href="https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/The_head_metadata_in_HTML#Other_types_of_metadata">https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/The_head_metadata_in_HTML#Other_types_of_metadata</a></li>
</ul></li>
<li>The icon</li>
<li>The CSS stylesheet (covered in the latter part of the document)</li>
</ul>
<div class="org-src-container">
<pre class="src src-html"><<span style="color: #0000ff;">head</span>>
<<span style="color: #0000ff;">title</span>><span style="font-weight: bold; text-decoration: underline;">My test page</span></<span style="color: #0000ff;">title</span>>
<<span style="color: #0000ff;">meta</span> <span style="color: #a0522d;">charset</span>=<span style="color: #8b2252;">"utf-8"</span>>
<<span style="color: #0000ff;">meta</span> <span style="color: #a0522d;">name</span>=<span style="color: #8b2252;">"author"</span> <span style="color: #a0522d;">content</span>=<span style="color: #8b2252;">"George Kontsevich"</span>>
<<span style="color: #0000ff;">meta</span> <span style="color: #a0522d;">name</span>=<span style="color: #8b2252;">"description"</span> <span style="color: #a0522d;">content</span>=<span style="color: #8b2252;">"This is a dummy description for a test page</span>
<span style="color: #8b2252;"> that I've made to remind myself of HTML stuff"</span>>
<<span style="color: #0000ff;">link</span> <span style="color: #a0522d;">rel</span>=<span style="color: #8b2252;">"shortcut icon"</span> <span style="color: #a0522d;">href</span>=<span style="color: #8b2252;">"gk.ico"</span> <span style="color: #a0522d;">type</span>=<span style="color: #8b2252;">"image/x-icon"</span>>
<<span style="color: #0000ff;">link</span> <span style="color: #a0522d;">rel</span>=<span style="color: #8b2252;">"stylesheet"</span> <span style="color: #a0522d;">href</span>=<span style="color: #8b2252;">"css-demo.css"</span>>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-html"></<span style="color: #0000ff;">head</span>>
</pre>
</div>
</div>
</div>
<div id="outline-container-org701520e" class="outline-3">
<h3 id="org701520e">Body</h3>
<div class="outline-text-3" id="text-org701520e">
<p>
Now we have the stuff that ends up displaying on the page
</p>
<div class="org-src-container">
<pre class="src src-html"><<span style="color: #0000ff;">body</span>>
<<span style="color: #0000ff;">h1</span>><span style="font-weight: bold; text-decoration: underline;"> This is an h1 (top level) header - usuall one per page </span></<span style="color: #0000ff;">h1</span>>
</pre>
</div>
</div>
<div id="outline-container-orgcbc454c" class="outline-4">
<h4 id="orgcbc454c">Text formating</h4>
<div class="outline-text-4" id="text-orgcbc454c">
<div class="org-src-container">
<pre class="src src-html"> <<span style="color: #0000ff;">p</span>>This is a paragraph</<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">ul</span>>
<<span style="color: #0000ff;">li</span>>unordered</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span>>list</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span>>of</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span>>words</<span style="color: #0000ff;">li</span>>
</<span style="color: #0000ff;">ul</span>>
<<span style="color: #0000ff;">ol</span>>
<<span style="color: #0000ff;">li</span>>ordered</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span>>list</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span>>of</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span>>words</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">ul</span>>
<<span style="color: #0000ff;">li</span>>with</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span>>an</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span>>unordered</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span>>list</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span>>of</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span>>words</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span>>inside</<span style="color: #0000ff;">li</span>>
</<span style="color: #0000ff;">ul</span>>
</<span style="color: #0000ff;">ol</span>>
<<span style="color: #0000ff;">p</span>>The following is with emphasis: <<span style="color: #0000ff;">em</span>><span style="text-decoration: underline;">pandas</span></<span style="color: #0000ff;">em</span>></<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">p</span>>The following is strong: <<span style="color: #0000ff;">strong</span>><span style="font-weight: bold;">more pandas</span></<span style="color: #0000ff;">strong</span>></<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">p</span>>Similarly bold (which should be used less b/c it has no semantic meaning): <<span style="color: #0000ff;">b</span>><span style="font-weight: bold;">all the pandas</span></<span style="color: #0000ff;">b</span>></<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">p</span>>
Descriptions List:
<<span style="color: #0000ff;">dl</span>>
<<span style="color: #0000ff;">dt</span>>soliloquy</<span style="color: #0000ff;">dt</span>>
<<span style="color: #0000ff;">dd</span>>In drama, where a character speaks to themselves, representing their inner thoughts or feelings and in the process relaying them to the audience (but not to other characters.)</<span style="color: #0000ff;">dd</span>>
<<span style="color: #0000ff;">dt</span>>monologue</<span style="color: #0000ff;">dt</span>>
<<span style="color: #0000ff;">dd</span>>In drama, where a character speaks their thoughts out loud to share them with the audience and any other characters present.</<span style="color: #0000ff;">dd</span>>
<<span style="color: #0000ff;">dt</span>>aside</<span style="color: #0000ff;">dt</span>>
<<span style="color: #0000ff;">dd</span>>In drama, where a character shares a comment only with the audience for humorous or dramatic effect. This is usually a feeling, thought, or piece of additional background information.</<span style="color: #0000ff;">dd</span>>
</<span style="color: #0000ff;">dl</span>>
</<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">p</span>>The quote element — <<span style="color: #0000ff;">code</span>><span style="color: #a0522d;">&lt;</span>q<span style="color: #a0522d;">&gt;</span></<span style="color: #0000ff;">code</span>> — is <<span style="color: #0000ff;">q</span> <span style="color: #a0522d;">cite</span>=<span style="color: #8b2252;">"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q"</span>>intended
for short quotations that don't require paragraph breaks.</<span style="color: #0000ff;">q</span>></<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">blockquote</span> <span style="color: #a0522d;">cite</span>=<span style="color: #8b2252;">"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote"</span>>
<<span style="color: #0000ff;">p</span>>The <<span style="color: #0000ff;">strong</span>>HTML <<span style="color: #0000ff;">code</span>><span style="color: #a0522d;">&lt;</span>blockquote<span style="color: #a0522d;">&gt;</span></<span style="color: #0000ff;">code</span>> Element</<span style="color: #0000ff;">strong</span>> (or <<span style="color: #0000ff;">em</span>><span style="text-decoration: underline;">HTML Block</span>
<span style="text-decoration: underline;"> Quotation Element</span></<span style="color: #0000ff;">em</span>>) indicates that the enclosed text is an extended quotation.</<span style="color: #0000ff;">p</span>>
</<span style="color: #0000ff;">blockquote</span>>
<<span style="color: #0000ff;">p</span>>We use <<span style="color: #0000ff;">abbr</span> <span style="color: #a0522d;">title</span>=<span style="color: #8b2252;">"Hypertext Markup Language"</span>>HTML</<span style="color: #0000ff;">abbr</span>> to structure our web documents.</<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">p</span>>I think <<span style="color: #0000ff;">abbr</span> <span style="color: #a0522d;">title</span>=<span style="color: #8b2252;">"Reverend"</span>>Rev.</<span style="color: #0000ff;">abbr</span>> Green did it in the kitchen with the chainsaw.</<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">p</span>>Caffeine's chemical formula is C<<span style="color: #0000ff;">sub</span>>8</<span style="color: #0000ff;">sub</span>>H<<span style="color: #0000ff;">sub</span>>10</<span style="color: #0000ff;">sub</span>>N<<span style="color: #0000ff;">sub</span>>4</<span style="color: #0000ff;">sub</span>>O<<span style="color: #0000ff;">sub</span>>2</<span style="color: #0000ff;">sub</span>>.</<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">pre</span>><<span style="color: #0000ff;">code</span>>var para = document.querySelector('p');
para.onclick = function() {
alert('Owww, stop poking me!');
}</<span style="color: #0000ff;">code</span>></<span style="color: #0000ff;">pre</span>>
<<span style="color: #0000ff;">p</span>>You shouldn't use presentational elements like <<span style="color: #0000ff;">code</span>><span style="color: #a0522d;">&lt;</span>font<span style="color: #a0522d;">&gt;</span></<span style="color: #0000ff;">code</span>> and <<span style="color: #0000ff;">code</span>><span style="color: #a0522d;">&lt;</span>center<span style="color: #a0522d;">&gt;</span></<span style="color: #0000ff;">code</span>>.</<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">p</span>>In the above JavaScript example, <<span style="color: #0000ff;">var</span>><span style="text-decoration: underline;">para</span></<span style="color: #0000ff;">var</span>> represents a paragraph element.</<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">p</span>>Select all the text with <<span style="color: #0000ff;">kbd</span>>Ctrl</<span style="color: #0000ff;">kbd</span>>/<<span style="color: #0000ff;">kbd</span>>Cmd</<span style="color: #0000ff;">kbd</span>> + <<span style="color: #0000ff;">kbd</span>>A</<span style="color: #0000ff;">kbd</span>>.</<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">pre</span>>$ <<span style="color: #0000ff;">kbd</span>>ping mozilla.org</<span style="color: #0000ff;">kbd</span>>
<<span style="color: #0000ff;">samp</span>>PING mozilla.org (63.245.215.20): 56 data bytes
64 bytes from 63.245.215.20: icmp_seq=0 ttl=40 time=158.233 ms</<span style="color: #0000ff;">samp</span>></<span style="color: #0000ff;">pre</span>>
</pre>
</div>
</div>
</div>
<div id="outline-container-org40d053e" class="outline-4">
<h4 id="org40d053e">Links</h4>
<div class="outline-text-4" id="text-org40d053e">
<p>
In the following example we wrap some text with a hyperlink
</p>
<div class="org-src-container">
<pre class="src src-html"><<span style="color: #0000ff;">p</span>>Now we want to create to my github
<<span style="color: #0000ff;">a</span> <span style="color: #a0522d;">href</span>=<span style="color: #8b2252;">"https://github.com/geokon-gh/"</span>
<span style="color: #a0522d;">title</span>=<span style="color: #8b2252;">"This is the mouseover text! :)"</span>>My Github (with special mouse over text!)</<span style="color: #0000ff;">a</span>>
</<span style="color: #0000ff;">p</span>>
</pre>
</div>
<p>
However you can also wrap images and other elements<br>
As well as link to IDs (once set)
</p>
<div class="org-src-container">
<pre class="src src-html"><<span style="color: #0000ff;">h2</span> <span style="color: #a0522d;">id</span>=<span style="color: #8b2252;">"Mailing_address"</span>><span style="font-weight: bold; font-style: italic; text-decoration: underline;">Mailing address</span></<span style="color: #0000ff;">h2</span>>
<<span style="color: #0000ff;">p</span>>Want to write us a letter? Use our <<span style="color: #0000ff;">a</span> <span style="color: #a0522d;">href</span>=<span style="color: #8b2252;">"html-demo.html#Mailing_address"</span>>mailing address</<span style="color: #0000ff;">a</span>>.</<span style="color: #0000ff;">p</span>>
</pre>
</div>
<p>
You can also set default download names. For instance this is a link to the latest Firefox:
</p>
<div class="org-src-container">
<pre class="src src-html"><<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">a</span> <span style="color: #a0522d;">href</span>=<span style="color: #8b2252;">"https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=en-US"</span>
<span style="color: #a0522d;">download</span>=<span style="color: #8b2252;">"some-silly-default-file-name.exe"</span>>
Download Latest Firefox for Windows (64-bit) (English, US)
</<span style="color: #0000ff;">a</span>>
</<span style="color: #0000ff;">p</span>>
</pre>
</div>
<p>
Or link to emails
</p>
<div class="org-src-container">
<pre class="src src-html"><<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">a</span> <span style="color: #a0522d;">href</span>=<span style="color: #8b2252;">"mailto:[email protected][email protected]&[email protected]&subject=The%20subject%20of%20the%20email&body=The%20body%20of%20the%20email"</span>>
Send mail with cc, bcc, subject and body
</<span style="color: #0000ff;">a</span>>
</<span style="color: #0000ff;">p</span>>
</pre>
</div>
</div>
</div>
<div id="outline-container-org50936f8" class="outline-4">
<h4 id="org50936f8">Images</h4>
<div class="outline-text-4" id="text-org50936f8">
<p>
The <code><figure></code> wrapper <code><figcaption></code> elements are for <b>HTML5</b> and allow for captions with an element that has the appropriate semantic meaning (I've doubled the icon's actual width and height)
</p>
<div class="org-src-container">
<pre class="src src-html"><<span style="color: #0000ff;">figure</span>>
<<span style="color: #0000ff;">img</span> <span style="color: #a0522d;">src</span>=<span style="color: #8b2252;">"gk.ico"</span>
<span style="color: #a0522d;">alt</span>=<span style="color: #8b2252;">"This is text that displays if the image doesn't load"</span>
<span style="color: #a0522d;">width</span>=<span style="color: #8b2252;">"94"</span>
<span style="color: #a0522d;">height</span>=<span style="color: #8b2252;">"112"</span>
<span style="color: #a0522d;">title</span>=<span style="color: #8b2252;">"This is some mouse-over text"</span>>
<<span style="color: #0000ff;">figcaption</span>>This is the caption below the icon image.</<span style="color: #0000ff;">figcaption</span>>
</<span style="color: #0000ff;">figure</span>>
</pre>
</div>
</div>
</div>
<div id="outline-container-org7f0a17f" class="outline-4">
<h4 id="org7f0a17f">Video/Audio</h4>
<div class="outline-text-4" id="text-org7f0a17f">
<p>
Just a small basic example (205kB file). For more details see: <a href="https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Video_and_audio_content">https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Video_and_audio_content</a>
</p>
<div class="org-src-container">
<pre class="src src-html"><<span style="color: #0000ff;">video</span> <span style="color: #a0522d;">src</span>=<span style="color: #8b2252;">"pregnant-shrimp.webm"</span> controls>
<<span style="color: #0000ff;">p</span>>Your browser doesn't support HTML5 video. Here is a <<span style="color: #0000ff;">a</span> <span style="color: #a0522d;">href</span>=<span style="color: #8b2252;">"pregnant-shrimp.webm"</span>>link to the video</<span style="color: #0000ff;">a</span>> instead.</<span style="color: #0000ff;">p</span>>
</<span style="color: #0000ff;">video</span>>
</pre>
</div>
</div>
</div>
<div id="outline-container-org7a39180" class="outline-4">
<h4 id="org7a39180">iframes</h4>
<div class="outline-text-4" id="text-org7a39180">
<p>
Are used to embed other webpages into the current page
</p>
<div class="org-src-container">
<pre class="src src-html"><<span style="color: #0000ff;">p</span>> Below is an iframe 200 pix high </<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">iframe</span> <span style="color: #a0522d;">src</span>=<span style="color: #8b2252;">"index.html"</span>
<span style="color: #a0522d;">width</span>=<span style="color: #8b2252;">"100%"</span> <span style="color: #a0522d;">height</span>=<span style="color: #8b2252;">"200"</span> <span style="color: #a0522d;">frameborder</span>=<span style="color: #8b2252;">"0"</span>
allowfullscreen sandbox>
<<span style="color: #0000ff;">p</span>> <<span style="color: #0000ff;">a</span> <span style="color: #a0522d;">href</span>=<span style="color: #8b2252;">"https://geokon-gh.github.io/index.html"</span>
Fallback link for browsers that don<span style="color: #8b2252;">'t support iframes</span>
<span style="color: #8b2252;"> </a> </p></span>
<span style="color: #8b2252;"></iframe></span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org4519b95" class="outline-3">
<h3 id="org4519b95">Closing stuff</h3>
<div class="outline-text-3" id="text-org4519b95">
<p>
Gotta close some of the outer brackets
</p>
<div class="org-src-container">
<pre class="src src-html"> </<span style="color: #0000ff;">body</span>>
</<span style="color: #0000ff;">html</span>>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgf67593f" class="outline-2">
<h2 id="orgf67593f">CSS</h2>
<div class="outline-text-2" id="text-orgf67593f">
</div>
<div id="outline-container-org2eca971" class="outline-3">
<h3 id="org2eca971">Rules</h3>
<div class="outline-text-3" id="text-org2eca971">
<p>
Or <i>ruleset</i>. Each <i>rule</i> is a paired <b>selector</b> and a <b>declaration block</b>
</p>
</div>
<div id="outline-container-orgdf25311" class="outline-4">
<h4 id="orgdf25311">Selector</h4>
<div class="outline-text-4" id="text-orgdf25311">
<p>
Is a pattern that matches some element on a page like
</p>
<div class="org-src-container">
<pre class="src src-css">h1
</pre>
</div>
</div>
<ul class="org-ul">
<li><a id="org34e1254"></a>Class selectors<br>
<div class="outline-text-5" id="text-org34e1254">
<p>
You can explicitely give HTML elements a class name in an <i>HTML attribute</i>. Classes can be assigned at random and reused
</p>
<div class="org-src-container">
<pre class="src src-html"><<span style="color: #0000ff;">ul</span>>
<<span style="color: #0000ff;">li</span> <span style="color: #a0522d;">class</span>=<span style="color: #8b2252;">"first done"</span>>Create an HTML document</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span> <span style="color: #a0522d;">class</span>=<span style="color: #8b2252;">"second done"</span>>Create a CSS style sheet</<span style="color: #0000ff;">li</span>>
<<span style="color: #0000ff;">li</span> <span style="color: #a0522d;">class</span>=<span style="color: #8b2252;">"third"</span>>Link them all together</<span style="color: #0000ff;">li</span>>
</<span style="color: #0000ff;">ul</span>>
</pre>
</div>
<p>
And then using a dot notation you can select based on the class name
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">.first </span>{
<span style="color: #a020f0;">font-weight</span>: bold;
}
<span style="color: #0000ff;">.done </span>{
<span style="color: #a020f0;">text-decoration</span>: line-through;
}
</pre>
</div>
</div>
</li>
<li><a id="org22a92b2"></a>ID selectors<br>
<div class="outline-text-5" id="text-org22a92b2">
<p>
Similar to Class selectors but for a <i>unique</i> ID
</p>
<div class="org-src-container">
<pre class="src src-html"><<span style="color: #0000ff;">p</span> <span style="color: #a0522d;">id</span>=<span style="color: #8b2252;">"polite"</span>> — "Good morning."</<span style="color: #0000ff;">p</span>>
<<span style="color: #0000ff;">p</span> <span style="color: #a0522d;">id</span>=<span style="color: #8b2252;">"rude"</span>> — "Go away!"</<span style="color: #0000ff;">p</span>>
</pre>
</div>
<p>
And you can can then reference it in your CSS with the pound notation
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">#polite </span>{
<span style="color: #a020f0;">font-family</span>: cursive;
}
<span style="color: #0000ff;">#rude </span>{
<span style="color: #a020f0;">font-family</span>: monospace;
<span style="color: #a020f0;">text-transform</span>: uppercase;
}
</pre>
</div>
</div>
</li>
<li><a id="org6a3f31b"></a>Universal selectors<br>
<div class="outline-text-5" id="text-org6a3f31b">
<p>
Just selects everything. Can be useful to combine with other selectors
#+BEGIN<sub>SRC</sub> css
</p>
</div>
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-org22b8771" class="outline-2">
<h2 id="org22b8771">{</h2>
<div class="outline-text-2" id="text-org22b8771">
<p>
padding: 5px;
border: 1px solid black;
background: rgba(255,0,0,0.25)
}
#+END<sub>SRC</sub>
</p>
</div>
<ul class="org-ul">
<li><a id="org4f8ffda"></a>Attribute selectors<br>
<div class="outline-text-5" id="text-org4f8ffda">
<p>
<code>[attr]</code> : This selector will select all elements with the attribute attr, whatever its value.
<code>[attr=val]</code> : This selector will select all elements with the attribute attr, but only if its value is val.
<code>[attr~=val]</code> : This selector will select all elements with the attribute attr, but only if val is one of a space-separated list of words contained in attr's value.
<code>[attr^=val]</code> : This selector will select all elements with the attribute attr for which the value starts with val.
<code>[attr$=val]</code> : This selector will select all elements with the attribute attr for which the value ends with val.
<code>[attr*=val]</code> : This selector will select all elements with the attribute attr for which the value contains the substring val. (A substring is simply part of a string, e.g. "cat" is a substring in the string "caterpillar".)
</p>
</div>
</li>
<li><a id="org1a3113e"></a>Pseudo-class selectors<br>
<div class="outline-text-5" id="text-org1a3113e">
<p>
Are a bit involved. These are at the end of an attribute and go after a <i>colon</i>. The designate a certain element state. See the page: <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Pseudo-classes_and_pseudo-elements">https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Pseudo-classes_and_pseudo-elements</a>
example:
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">a </span>{
<span style="color: #a020f0;">color</span>: <span style="color: #ffffff; background-color: #0000ff;">blue</span>;
<span style="color: #a020f0;">font-weight</span>: bold;
}
<span style="color: #0000ff;">a:visited </span>{
<span style="color: #a020f0;">color</span>: <span style="color: #ffffff; background-color: #0000ff;">blue</span>;
}
<span style="color: #a020f0;">a</span>:hover,
<span style="color: #a020f0;">a</span>:active,
<span style="color: #0000ff;">a:focus </span>{
<span style="color: #a020f0;">color</span>: <span style="color: #ffffff; background-color: #8b0000;">darkred</span>;
<span style="color: #a020f0;">text-decoration</span>: none;
}
</pre>
</div>
</div>
</li>
<li><a id="org373781a"></a>Pseudo-element selectors<br>
<div class="outline-text-5" id="text-org373781a">
<p>
Can let you select a part of the element to modify. For instance this appends a little arrow to the element
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">[href^=http]::after </span>{
<span style="color: #a020f0;">content</span>: <span style="color: #8b2252;">'⤴'</span>;
}
</pre>
</div>
</div>
</li>
<li><a id="org8dd1f3e"></a>Combinators<br>
<div class="outline-text-5" id="text-org8dd1f3e">
<p>
<code>A, B</code> - matches A and/or B
<code>A B</code> - matches a B that is a descendent of A
<code>A > B</code> - matches B that is a direct child of an A
<code>A + B</code> - matches B that is the next sibling of an element matching A
<code>A ~ B</code> - matches B that is the one of the next sibling of an element matching A
</p>
</div>
</li>
</ul>
<div id="outline-container-org93ca9a2" class="outline-4">
<h4 id="org93ca9a2">Declaration Block</h4>
<div class="outline-text-4" id="text-org93ca9a2">
<p>
Is a series of declaration - each a pair of a <i>property</i> and a <i>value</i>
</p>
<div class="org-src-container">
<pre class="src src-css">{
<span style="color: #a020f0;">color</span>: <span style="color: #ffffff; background-color: #ff0000;">red</span>;
<span style="color: #a020f0;">background-color</span>: <span style="color: #ffffff; background-color: #808080;">grey</span>;
<span style="color: #a020f0;">border</span>: 1px solid <span style="color: #ffffff; background-color: #000000;">black</span>;
}
</pre>
</div>
<p>
Numbers can be in <b>absolute units</b> like <code>px</code> (pixels) or <code>q</code> (quarter millimeters) <code>mm</code> <code>cm</code> <code>in</code> <code>pt</code> (1/72 of an inch) <code>pc</code> (picas - 12 points). Or they can be in <b>relative units</b> like <code>em</code> (font size of the current element), <code>ex</code> (size of an x) <code>ch</code> (size of the number 0), <code>rem</code> (root <code>em</code>, ie. the top level default font), <code>vw~/~vh</code> 1/100<sup>th</sup> of the width/height of the viewport
</p>
<p>
You can also add things for animation:
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #483d8b;">@keyframes</span> rotate {
<span style="color: #0000ff;">0% </span>{
<span style="color: #a020f0;">transform</span>: rotate(0deg);
}
<span style="color: #0000ff;">100% </span>{
<span style="color: #a020f0;">transform</span>: rotate(360deg);
}
}
<span style="color: #0000ff;">p </span>{
<span style="color: #a020f0;">color</span>: <span style="color: #ffffff; background-color: #ff0000;">red</span>;
<span style="color: #a020f0;">width</span>: 100px;
<span style="color: #a020f0;">font-size</span>: 40px;
<span style="color: #a020f0;">transform-origin</span>: center;
}
<span style="color: #0000ff;">p:hover </span>{
<span style="color: #a020f0;">animation-name</span>: rotate;
<span style="color: #a020f0;">animation-duration</span>: 0.6s;
<span style="color: #a020f0;">animation-timing-function</span>: linear;
<span style="color: #a020f0;">animation-iteration-count</span>: 5;
}
</pre>
</div>
<p>
For details concerning colors, see the Mozilla tutorial: <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Values_and_units">https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Values_and_units</a>
</p>
<p>
More specific rules will override less specific ones
</p>
</div>
</div>
<div id="outline-container-org6c8bb89" class="outline-3">
<h3 id="org6c8bb89">Statements</h3>
<div class="outline-text-3" id="text-org6c8bb89">
<p>
Are additional blocks that can be written in CSS. The most common are <i>at-rules</i> which sometimes can be <i>nested</i>
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #483d8b;">@media</span> (min-width: 801px) {
<span style="color: #0000ff;">body </span>{
<span style="color: #a020f0;">margin</span>: 0 auto;
<span style="color: #a020f0;">width</span>: 800px;
}
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb9ebba1" class="outline-3">
<h3 id="orgb9ebba1">Cascade</h3>
<div class="outline-text-3" id="text-orgb9ebba1">
<p>
How are HTML elements styled?
</p>
<ul class="org-ul">
<li>Each of the element's `properties` are looked up</li>
<li>There will be a default `user-agent` value that can be overriden</li>
</ul>
<p>
Overriding is done using a <b>declaration</b>
ex:
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #a020f0;">color</span>: <span style="color: #ffffff; background-color: #000000;">black</span>;
</pre>
</div>
<p>
If the declaration is <b>in-line</b> with HTML then that is used directly.
</p>
<p>
Else, it uses the style sheet and finds the most specific <b>selector</b>
</p>
</div>
<div id="outline-container-org6b75dd0" class="outline-4">
<h4 id="org6b75dd0">Selector Specificity</h4>
<div class="outline-text-4" id="text-org6b75dd0">
<p>
The more specific a selector is, the higher it's precedence.
Its properites override less specific selectors' properties.
Precedence is determines based on the following (in decreasing importance)
</p>
<ul class="org-ul">
<li>Based on type</li>
</ul>
<p>
IDs -> Classes -> Tags
</p>
<ul class="org-ul">
<li>Based on the number of specifiers</li>
</ul>
<p>
Two specified classes is more specific than one specified class
</p>
<ul class="org-ul">
<li>Based on source code order</li>
</ul>
<p>
(in the `.css` file)
</p>
<p>
The first two rules can be summarized with 3 numbers
</p>
<blockquote>
<p>
1 ID, 2 classes and 3 tags -> <code>1,2,3</code>
</p>
</blockquote>
</div>
</div>
<div id="outline-container-org1d18d59" class="outline-4">
<h4 id="org1d18d59">Source Order</h4>
<div class="outline-text-4" id="text-org1d18d59">
<p>
Sometimes you are forced to have multiple selectors of equal value
In this case the order in the source code file will matter
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">a:link </span>{..}
<span style="color: #0000ff;">a:visited </span>{..}
<span style="color: #0000ff;">a:hover </span>{..}
<span style="color: #0000ff;">a:active </span>{..}
</pre>
</div>
<blockquote>
<p>
One HTML <a> can match to multiple of these
And the last 3 should situationally override `a:link`'s declarations
</p>
</blockquote>
<blockquote>
<p>
<b>Notes</b>:<br>
We try to use as little specificity as possible.
This allows us to easily style a particular element when needed
</p>
</blockquote>
</div>
</div>
<div id="outline-container-org15178c6" class="outline-4">
<h4 id="org15178c6"><code>important!</code></h4>
<div class="outline-text-4" id="text-org15178c6">
<p>
This "cascade", overriding with more specific selectors, can be blocked.
A less specific selector can mark a property as <code>!important</code>
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #a020f0;">color</span>: <span style="color: #ffffff; background-color: #ff0000;">red</span> <span style="color: #483d8b;">!important</span>;
</pre>
</div>
<blockquote>
<p>
This will also make it higher priority than any inline declarations
Unless they too are marked <code>!important</code> ..
</p>
</blockquote>
</div>
</div>
</div>
<div id="outline-container-org3964023" class="outline-3">
<h3 id="org3964023">Inheritance</h3>
<div class="outline-text-3" id="text-org3964023">
<p>
Some elements will pass down properties to their children
These are used if the child has no style set with a selector
</p>
<blockquote>
<p>
<b>Note</b>:<br>
This is a process parallel to the cascade..
and some properties are passed down and others are not ..
</p>
</blockquote>
<p>
Example
</p>
<blockquote>
<p>
If a <body> is styled with a `font-family`
All child elements will inherit and use this `font-family`
Unless they have a different `font-family` set by a declaration
</p>
</blockquote>
</div>
<div id="outline-container-orgda1058d" class="outline-4">
<h4 id="orgda1058d"><code>inherit</code></h4>
<div class="outline-text-4" id="text-orgda1058d">
<p>
Cascade selectors will take precedence and override any inherited property
However a more specific selector can revert it back using <code>inherit</code>
The element will then go start inheriting the value of its parent
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">a.link </span>{<span style="color: #a020f0;">color</span>: <span style="color: #ffffff; background-color: #0000ff;">blue</span>;}
<span style="color: #0000ff;">.footer </span>{<span style="color: #a020f0;">color</span>: <span style="color: #ffffff; background-color: #808080;">gray</span>;}
<span style="color: #0000ff;">.footer a </span>{<span style="color: #a020f0;">color</span>: inherit;}
</pre>
</div>
<blockquote>
<ul class="org-ul">
<li>This makes links blue</li>
<li>Then makes the `footer` gray</li>
<li>Then makes links in the footer go back to following the footer `color`</li>
</ul>
</blockquote>
<p>
<code>inherit</code> can also make normally un-inherited properties inherited ..
</p>
<p>
<code>initial</code> will reset the value to the "default" (browser's stylesheet..)
</p>
</div>
</div>
<div id="outline-container-orgaaadfbc" class="outline-4">
<h4 id="orgaaadfbc"><code>initial</code></h4>
<div class="outline-text-4" id="text-orgaaadfbc">
<p>
<b>Shorthands</b> like <code>font</code> and <code>background</code> set multiple properties at once.
If values are omitted then they are silently set to their <code>initial</code> value
And they will override any less-specific values you'd set
</p>
<pre class="example">
h1 { font-weight: bold; }
.title { font: 32px Helvetica, Arial, sans-serif; }
</pre>
<blockquote>
<ul class="org-ul">
<li>The second property is more specific (b/c it's a class based selector)</li>
<li>A <code>font-weight</code> was implicit in the <code>font</code></li>
<li>B/c it was omitted it was reset to default <code>normal</code></li>
</ul>
<p>
And the less specific <code>font-weight</code> in <code>h1</code> was overriden
</p>
</blockquote>
<p>
Sometimes values are magically inferred - like with padding
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #a020f0;">padding</span>: 5px 15px;
</pre>
</div>
<p>
Normally you'd have <code>[top right bottom left]</code> padding
But with just two values it will set the vertical and horizontal padding
</p>
<p>
Further confusing things
padding: 1em 2am
1em Vertical (top/bottom)
2em Horizontal (right/left)
But…
background-position: 25% 75%
25% Horizontal (right/left)
75% Vertival (top/bottom)
</p>
</div>
</div>
</div>
<div id="outline-container-org21a8306" class="outline-3">
<h3 id="org21a8306">Lengths</h3>
<div class="outline-text-3" id="text-org21a8306">
</div>
<div id="outline-container-orgaeb511b" class="outline-4">
<h4 id="orgaeb511b">Absolute Lengths</h4>
<div class="outline-text-4" id="text-orgaeb511b">
<blockquote>
<p>
1in = 25.4mm = 2.54cm = 6pc = 72pt = 96px
</p>
</blockquote>
<p>
Note: pixels aren't pixels
</p>
</div>
</div>
<div id="outline-container-org1e3695f" class="outline-4">
<h4 id="org1e3695f">Relative Lengths</h4>
<div class="outline-text-4" id="text-org1e3695f">
<p>
<code>1.0em</code> = font-size of the current element
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #a020f0;">padding</span>: 1em;
</pre>
</div>
<p>
Padding will be the size of the font
</p>
<p>
The <code>font-size</code> can be set later/separately.
And properties sized in <code>em</code> will adjust
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">.box </span>{ <span style="color: #a020f0;">padding</span>: 1em; }
<span style="color: #0000ff;">.box .small </span>{ <span style="color: #a020f0;">font-size</span>: 12px;}
<span style="color: #0000ff;">.box .large </span>{ <span style="color: #a020f0;">font-size</span>: 16px;}
</pre>
</div>
<p>
And then all <code>.box</code> elements will have <code>1em</code> padding..
</p>
<p>
If you set a <code>font-size</code> using <code>em</code> then it uses the parent's <code>font-size</code>
This makes <code>em</code> have a slighting different meaning in one css rule
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">body </span>{ <span style="color: #a020f0;">font-size</span>: 16px; }
<span style="color: #0000ff;">.thing </span>{ <span style="color: #a020f0;">font-size</span>: 1.2em;
<span style="color: #a020f0;">padding</span>: 1.2em: }
</pre>
</div>
<blockquote>
<ul class="org-ul">
<li>The first 1.2em will be relative to 16px (so 19.2px)</li>
<li>While the second 1.2em is relative to the new local `font-size` 19.2px</li>
</ul>
<p>
So the `padding` will actually be 23.04px
</p>
</blockquote>
<p>
<code>1.0rem</code> = font-size of the root
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">:root</span> { <span style="color: #a020f0;">font-size</span>: 1em: }
<span style="color: #0000ff;">ul </span>{ <span style="color: #a020f0;">font-size</span>: 0.8rem; }
</pre>
</div>
<blockquote>
<ul class="org-ul">
<li>The first will use the browser default <code>font-size</code> of</li>
<li>`:root` is equivalent to `html`</li>
<li>The recond will be relative to that 16px (12.8px)</li>
</ul>
</blockquote>
<p>
Generally you will want to have the root have a sensible font-size
Most elements won't need adjustment and will just inherit the default
Those that do can be adjusted can then be tuned with `rem` units
</p>
<p>
You can then adjust the root font-size and everything will adjust
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">:root</span> { <span style="color: #a020f0;">font-size</span>: 0.75em; }
<span style="color: #483d8b;">@media</span> (min-width: 800px) {
<span style="color: #0000ff;">:root</span> { <span style="color: #a020f0;">font-size</span>: 0.875em; } }
<span style="color: #483d8b;">@media</span> (min-width: 1200px) {
<span style="color: #0000ff;">:root</span> { <span style="color: #a020f0;">font-size</span>: 1em; } }
</pre>
</div>
<p>
Here the root <code>font-size</code> is adjusted in a "responsive design" style..
</p>
</div>
</div>
<div id="outline-container-org2f21ac9" class="outline-4">
<h4 id="org2f21ac9">Selector Combinator</h4>
<div class="outline-text-4" id="text-org2f21ac9">
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">.panel </span>{ <span style="color: #a020f0;">padding</span>: 1em;}
<span style="color: #0000ff;">.panel > h2 </span>{ <span style="color: #a020f0;">margin-top</span>: 0;
<span style="color: #a020f0;">font-size</span>:0.8rem; }
</pre>
</div>
<p>
The second selector is the <i>direct descendant combinator</i>
It selects an <code>h2</code> that's a child element of a <code>.panel</code> element
</p>
</div>
</div>
<div id="outline-container-org6956bf7" class="outline-4">
<h4 id="org6956bf7">Viewport</h4>
<div class="outline-text-4" id="text-org6956bf7">
<ul class="org-ul">
<li>1.0vh 1/100th of the viewport height</li>
<li>1.0vw 1/100th of the viewport width</li>
<li>1.0vmin 1/100th of the smaller of the two</li>
<li>1.0vmax 1/100th of the larger of the two</li>
</ul>
<p>
The <b>viewport</b> is the visible area of the webpage in the browser
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">.square</span>{ <span style="color: #a020f0;">width</span>: 90vmin;
<span style="color: #a020f0;">height</span>: 90vmin; }
</pre>
</div>
<blockquote>
<p>
The square always fits in the visible area
</p>
</blockquote>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #a020f0;">font-size</span>: 2vw;
</pre>
</div>
<p>
Scales the font relative to the screen-size
.. but you may want to adjust with <code>calc</code>
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">:root</span> { <span style="color: #a020f0;">font-size</span>: calc(0.5em + 1vw);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org7090d8a" class="outline-3">
<h3 id="org7090d8a">CSS Variables</h3>
<div class="outline-text-3" id="text-org7090d8a">
<div class="org-src-container">
<pre class="src src-css"><span style="color: #0000ff;">:root</span> {
<span style="color: #a0522d;">--main-font</span>: Helvetica, Arial, sans-serif;
<span style="color: #a0522d;">--brand-color</span>: <span style="color: #ffffff; background-color: #369;">#369</span>;
}
<span style="color: #0000ff;">p </span>{
<span style="color: #a020f0;">font-family</span>: var(<span style="color: #a0522d;">--main-font</span>);
<span style="color: #a020f0;">color</span>: var(<span style="color: #a0522d;">--brand-color</span>, <span style="color: #ffffff; background-color: #0000ff;">blue</span>);
}
</pre>
</div>
<p>
A second value can be added to the <code>var</code> call
This functions as a fallback value.
For an old browser an explicit fallback is better
</p>
<div class="org-src-container">
<pre class="src src-css"><span style="color: #a020f0;">color</span>: <span style="color: #ffffff; background-color: #000000;">black</span>;
<span style="color: #a020f0;">color</span>: var(<span style="color: #a0522d;">--main-color</span>);
</pre>
</div>
<p>
Values can also be modified by containers and it will affect all children
</p>
</div>
</div>
<div id="outline-container-orgc7ed6ff" class="outline-3">
<h3 id="orgc7ed6ff">Box Model</h3>
<div class="outline-text-3" id="text-orgc7ed6ff">
</div>
<div id="outline-container-orga490d56" class="outline-4">
<h4 id="orga490d56"><code>box-sizing</code></h4>
<div class="outline-text-4" id="text-orga490d56">
<p>