sections.html
97.7 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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-US-x-Hixie" ><head><title>4.4 Sections — HTML5 </title><style type="text/css">
pre { margin-left: 2em; white-space: pre-wrap; }
h2 { margin: 3em 0 1em 0; }
h3 { margin: 2.5em 0 1em 0; }
h4 { margin: 2.5em 0 0.75em 0; }
h5, h6 { margin: 2.5em 0 1em; }
h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
p { margin: 1em 0; }
hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
dl, dd { margin-top: 0; margin-bottom: 0; }
dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
dt + dt { margin-top: 0; }
dd dt { margin-top: 0.25em; margin-bottom: 0; }
dd p { margin-top: 0; }
dd dl + p { margin-top: 1em; }
dd table + p { margin-top: 1em; }
p + * > li, dd li { margin: 1em 0; }
dt, dfn { font-weight: bold; font-style: normal; }
dt dfn { font-style: italic; }
pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
pre em { font-weight: bolder; font-style: normal; }
@media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
table { border-collapse: collapse; border-style: hidden hidden none hidden; }
table thead, table tbody { border-bottom: solid; }
table tbody th:first-child { border-left: solid; }
table tbody th { text-align: left; }
table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
.bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
.matrix, .matrix td { border: none; text-align: right; }
.matrix { margin-left: 2em; }
.dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
.dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
.dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
.toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
img.extra { float: right; }
pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; }
pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
pre.css:first-line { color: #AAAA50; }
dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
dl.domintro dd p { margin: 0.5em 0; }
dl.switch { padding-left: 2em; }
dl.switch > dt { text-indent: -1.5em; }
dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
dl.triple { padding: 0 0 0 1em; }
dl.triple dt, dl.triple dd { margin: 0; display: inline }
dl.triple dt:after { content: ':'; }
dl.triple dd:after { content: '\A'; white-space: pre; }
.diff-old { text-decoration: line-through; color: silver; background: transparent; }
.diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
a .diff-new { border-bottom: 1px blue solid; }
h2 { page-break-before: always; }
h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
h1 + h2, hr + h2.no-toc { page-break-before: auto; }
p > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]),
li > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]), { border-bottom: solid #9999CC; }
div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
div.head p { margin: 0; }
div.head h1 { margin: 0; }
div.head .logo { float: right; margin: 0 1em; }
div.head .logo img { border: none } /* remove border from top image */
div.head dl { margin: 1em 0; }
div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
body > .toc > li > * { margin-bottom: 0.5em; }
body > .toc > li > * > li > * { margin-bottom: 0.25em; }
.toc, .toc li { list-style: none; }
.brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
.brief li { margin: 0; padding: 0; }
.brief li p { margin: 0; padding: 0; }
.category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
.category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
.category-list li { display: inline; }
.category-list li:not(:last-child)::after { content: ', '; }
.category-list li > span, .category-list li > a { text-transform: lowercase; }
.category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
.XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
.XXX > :first-child { margin-top: 0; }
p .XXX { line-height: 3em; }
.annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
.annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
.annotation :link, .annotation :visited { color: inherit; }
.annotation :link:hover, .annotation :visited:hover { background: transparent; }
.annotation span { border: none ! important; }
.note { color: green; background: transparent; font-family: sans-serif; }
.warning { color: red; background: transparent; }
.note, .warning { font-weight: bolder; font-style: italic; }
p.note, div.note { padding: 0.5em 2em; }
span.note { padding: 0 2em; }
.note p:first-child, .warning p:first-child { margin-top: 0; }
.note p:last-child, .warning p:last-child { margin-bottom: 0; }
.warning:before { font-style: normal; }
p.note:before { content: 'Note: '; }
p.warning:before { content: '\26A0 Warning! '; }
.bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
.bookkeeping { font-size: 0.8em; margin: 2em 0; }
.bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
.bookkeeping dt { margin: 0.5em 2em 0; }
.bookkeeping dd { margin: 0 3em 0.5em; }
h4 { position: relative; z-index: 3; }
h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
.element {
background: #EEEEFF;
color: black;
margin: 0 0 1em 0.15em;
padding: 0 1em 0.25em 0.75em;
border-left: solid #9999FF 0.25em;
position: relative;
z-index: 1;
}
.element:before {
position: absolute;
z-index: 2;
top: 0;
left: -1.15em;
height: 2em;
width: 0.9em;
background: #EEEEFF;
content: ' ';
border-style: none none solid solid;
border-color: #9999FF;
border-width: 0.25em;
}
.example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
td > .example:only-child { margin: 0 0 0 0.1em; }
ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
ul.domTree li li { list-style: none; }
ul.domTree li:first-child::before { position: absolute; top: 0; height: 0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
ul.domTree li:not(:last-child)::after { position: absolute; top: 0; bottom: -0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
ul.domTree span { font-style: italic; font-family: serif; }
ul.domTree .t1 code { color: purple; font-weight: bold; }
ul.domTree .t2 { font-style: normal; font-family: monospace; }
ul.domTree .t2 .name { color: black; font-weight: bold; }
ul.domTree .t2 .value { color: blue; font-weight: normal; }
ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
ul.domTree .t7 code, .domTree .t8 code { color: green; }
ul.domTree .t10 code { color: teal; }
body.dfnEnabled dfn { cursor: pointer; }
.dfnPanel {
display: inline;
position: absolute;
z-index: 10;
height: auto;
width: auto;
padding: 0.5em 0.75em;
font: small sans-serif, Droid Sans Fallback;
background: #DDDDDD;
color: black;
border: outset 0.2em;
}
.dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
.dfnPanel :link, .dfnPanel :visited { color: black; }
.dfnPanel p { font-weight: bolder; }
.dfnPanel * + p { margin-top: 0.25em; }
.dfnPanel li { list-style-position: inside; }
#configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
#configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
#configUI p label { display: block; }
#configUI #updateUI, #configUI .loginUI { text-align: center; }
#configUI input[type=button] { display: block; margin: auto; }
fieldset { margin: 1em; padding: 0.5em 1em; }
fieldset > legend + * { margin-top: 0; }
fieldset > :last-child { margin-bottom: 0; }
fieldset p { margin: 0.5em 0; }
.stability {
position: fixed;
bottom: 0;
left: 0; right: 0;
margin: 0 auto 0 auto !important;
z-index: 1000;
width: 50%;
background: maroon; color: yellow;
-webkit-border-radius: 1em 1em 0 0;
-moz-border-radius: 1em 1em 0 0;
border-radius: 1em 1em 0 0;
-moz-box-shadow: 0 0 1em #500;
-webkit-box-shadow: 0 0 1em #500;
box-shadow: 0 0 1em red;
padding: 0.5em 1em;
text-align: center;
}
.stability strong {
display: block;
}
.stability input {
appearance: none; margin: 0; border: 0; padding: 0.25em 0.5em; background: transparent; color: black;
position: absolute; top: -0.5em; right: 0; font: 1.25em sans-serif; text-align: center;
}
.stability input:hover {
color: white;
text-shadow: 0 0 2px black;
}
.stability input:active {
padding: 0.3em 0.45em 0.2em 0.55em;
}
.stability :link, .stability :visited,
.stability :link:hover, .stability :visited:hover {
background: transparent;
color: white;
}
</style><link href="data:text/css,.impl%20%7B%20display:%20none;%20%7D%0Ahtml%20%7B%20border:%20solid%20yellow;%20%7D%20.domintro:before%20%7B%20display:%20none;%20%7D" id="author" rel="alternate stylesheet" title="Author documentation only"><link href="data:text/css,.impl%20%7B%20background:%20%23FFEEEE;%20%7D%20.domintro:before%20%7B%20background:%20%23FFEEEE;%20%7D" id="highlight" rel="alternate stylesheet" title="Highlight implementation
requirements"><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text/css"><style type="text/css">
.applies thead th > * { display: block; }
.applies thead code { display: block; }
.applies tbody th { whitespace: nowrap; }
.applies td { text-align: center; }
.applies .yes { background: yellow; }
.matrix, .matrix td { border: hidden; text-align: right; }
.matrix { margin-left: 2em; }
.dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
.dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
.dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
td.eg { border-width: thin; text-align: center; }
#table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
#table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
#table-example-1 caption { padding-bottom: 0.5em; }
#table-example-1 thead, #table-example-1 tbody { border: none; }
#table-example-1 th, #table-example-1 td { border: solid thin; }
#table-example-1 th { font-weight: normal; }
#table-example-1 td { border-style: none solid; vertical-align: top; }
#table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
#table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
#table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
#table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
#table-example-1 tbody td:first-child::after { content: leader(". "); }
#table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
#table-example-1 tbody td:first-child + td { width: 10em; }
#table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
#table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
.apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
.apple-table-examples * { font-family: "Times", serif; }
.apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
.apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
.apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
.apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
.apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
.apple-table-examples td { text-align: right; vertical-align: top; }
.apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
.apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
.apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
.apple-table-examples sup { line-height: 0; }
.details-example img { vertical-align: top; }
#base64-table {
white-space: nowrap;
font-size: 0.6em;
column-width: 6em;
column-count: 5;
column-gap: 1em;
-moz-column-width: 6em;
-moz-column-count: 5;
-moz-column-gap: 1em;
-webkit-column-width: 6em;
-webkit-column-count: 5;
-webkit-column-gap: 1em;
}
#base64-table thead { display: none; }
#base64-table * { border: none; }
#base64-table tbody td:first-child:after { content: ':'; }
#base64-table tbody td:last-child { text-align: right; }
#named-character-references-table {
white-space: nowrap;
font-size: 0.6em;
column-width: 30em;
column-gap: 1em;
-moz-column-width: 30em;
-moz-column-gap: 1em;
-webkit-column-width: 30em;
-webkit-column-gap: 1em;
}
#named-character-references-table > table > tbody > tr > td:first-child + td,
#named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
#named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
#named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }
.glyph.control { color: red; }
@font-face {
font-family: 'Essays1743';
src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
}
@font-face {
font-family: 'Essays1743';
font-weight: bold;
src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
}
@font-face {
font-family: 'Essays1743';
font-style: italic;
src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
}
@font-face {
font-family: 'Essays1743';
font-style: italic;
font-weight: bold;
src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
}
</style><style type="text/css">
.domintro:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: black; font-style: italic; border: solid 2px; background: white; padding: 0 0.25em; }
</style><script type="text/javascript">
function getCookie(name) {
var params = location.search.substr(1).split("&");
for (var index = 0; index < params.length; index++) {
if (params[index] == name)
return "1";
var data = params[index].split("=");
if (data[0] == name)
return unescape(data[1]);
}
var cookies = document.cookie.split("; ");
for (var index = 0; index < cookies.length; index++) {
var data = cookies[index].split("=");
if (data[0] == name)
return unescape(data[1]);
}
return null;
}
</script>
<script src="link-fixup.js" type="text/javascript"></script>
<link href="style.css" rel="stylesheet"><link href="scripting-1.html" title="4.3 Scripting" rel="prev">
<link href="spec.html#contents" title="Table of contents" rel="index">
<link href="grouping-content.html" title="4.5 Grouping content" rel="next">
</head><body>
<p class="stability" id="wip"><strong>This is a work in
progress!</strong> For the latest updates from the HTML WG, possibly
including important bug fixes, please look at the <a href="http://dev.w3.org/html5/spec/Overview.html">editor's draft</a> instead.
There may also be a more
<a href="http://www.w3.org/TR/html5">up-to-date Working Draft</a>
with changes based on resolution of Last Call issues.
<input onclick="closeWarning(this.parentNode)" type="button" value="╳⃝"></p>
<script type="text/javascript">
function closeWarning(element) {
element.parentNode.removeChild(element);
var date = new Date();
date.setDate(date.getDate()+4);
document.cookie = 'hide-obsolescence-warning=1; expires=' + date.toGMTString();
}
if (getCookie('hide-obsolescence-warning') == '1')
setTimeout(function () { document.getElementById('wip').parentNode.removeChild(document.getElementById('wip')); }, 2000);
</script>
<div class="head" id="head">
<p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
<h1>HTML5</h1>
</div><div>
<a href="scripting-1.html" class="prev">4.3 Scripting</a> –
<a href="spec.html#contents">Table of contents</a> –
<a href="grouping-content.html" class="next">4.5 Grouping content</a>
<ol class="toc"><li><ol><li><a href="sections.html#sections"><span class="secno">4.4 </span>Sections</a>
<ol><li><a href="sections.html#the-body-element"><span class="secno">4.4.1 </span>The <code>body</code> element</a></li><li><a href="sections.html#the-section-element"><span class="secno">4.4.2 </span>The <code>section</code> element</a></li><li><a href="sections.html#the-nav-element"><span class="secno">4.4.3 </span>The <code>nav</code> element</a></li><li><a href="sections.html#the-article-element"><span class="secno">4.4.4 </span>The <code>article</code> element</a></li><li><a href="sections.html#the-aside-element"><span class="secno">4.4.5 </span>The <code>aside</code> element</a></li><li><a href="sections.html#the-h1-h2-h3-h4-h5-and-h6-elements"><span class="secno">4.4.6 </span>The <code>h1</code>, <code>h2</code>, <code>h3</code>, <code>h4</code>, <code>h5</code>, and <code>h6</code> elements</a></li><li><a href="sections.html#the-hgroup-element"><span class="secno">4.4.7 </span>The <code>hgroup</code> element</a></li><li><a href="sections.html#the-header-element"><span class="secno">4.4.8 </span>The <code>header</code> element</a></li><li><a href="sections.html#the-footer-element"><span class="secno">4.4.9 </span>The <code>footer</code> element</a></li><li><a href="sections.html#the-address-element"><span class="secno">4.4.10 </span>The <code>address</code> element</a></li><li><a href="sections.html#headings-and-sections"><span class="secno">4.4.11 </span>Headings and sections</a>
<ol><li><a href="sections.html#outlines"><span class="secno">4.4.11.1 </span>Creating an outline</a></li></ol></li></ol></li></ol></li></ol></div>
<h3 id="sections"><span class="secno">4.4 </span>Sections</h3><h4 id="the-body-element"><span class="secno">4.4.1 </span>The <dfn><code>body</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
<dd><a href="#sectioning-root">Sectioning root</a>.</dd>
<dt>Contexts in which this element can be used:</dt>
<dd>As the second element in an <code><a href="semantics.html#the-html-element">html</a></code> element.</dd>
<dt>Content model:</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dt>Content attributes:</dt>
<dd><a href="elements.html#global-attributes">Global attributes</a></dd>
<dd><code title="handler-window-onafterprint"><a href="webappapis.html#handler-window-onafterprint">onafterprint</a></code></dd>
<dd><code title="handler-window-onbeforeprint"><a href="webappapis.html#handler-window-onbeforeprint">onbeforeprint</a></code></dd>
<dd><code title="handler-window-onbeforeunload"><a href="webappapis.html#handler-window-onbeforeunload">onbeforeunload</a></code></dd>
<dd><code title="handler-window-onblur"><a href="webappapis.html#handler-window-onblur">onblur</a></code></dd>
<dd><code title="handler-window-onerror"><a href="webappapis.html#handler-window-onerror">onerror</a></code></dd>
<dd><code title="handler-window-onfocus"><a href="webappapis.html#handler-window-onfocus">onfocus</a></code></dd>
<dd><code title="handler-window-onhashchange"><a href="webappapis.html#handler-window-onhashchange">onhashchange</a></code></dd>
<dd><code title="handler-window-onload"><a href="webappapis.html#handler-window-onload">onload</a></code></dd>
<dd><code title="handler-window-onmessage"><a href="webappapis.html#handler-window-onmessage">onmessage</a></code></dd>
<dd><code title="handler-window-onoffline"><a href="webappapis.html#handler-window-onoffline">onoffline</a></code></dd>
<dd><code title="handler-window-ononline"><a href="webappapis.html#handler-window-ononline">ononline</a></code></dd>
<dd><code title="handler-window-onpagehide"><a href="webappapis.html#handler-window-onpagehide">onpagehide</a></code></dd>
<dd><code title="handler-window-onpageshow"><a href="webappapis.html#handler-window-onpageshow">onpageshow</a></code></dd>
<dd><code title="handler-window-onpopstate"><a href="webappapis.html#handler-window-onpopstate">onpopstate</a></code></dd>
<dd><code title="handler-window-onredo"><a href="webappapis.html#handler-window-onredo">onredo</a></code></dd>
<dd><code title="handler-window-onresize"><a href="webappapis.html#handler-window-onresize">onresize</a></code></dd>
<dd><code title="handler-window-onscroll"><a href="webappapis.html#handler-window-onscroll">onscroll</a></code></dd>
<dd><code title="handler-window-onstorage"><a href="webappapis.html#handler-window-onstorage">onstorage</a></code></dd>
<dd><code title="handler-window-onundo"><a href="webappapis.html#handler-window-onundo">onundo</a></code></dd>
<dd><code title="handler-window-onunload"><a href="webappapis.html#handler-window-onunload">onunload</a></code></dd>
<dt>DOM interface:</dt>
<dd>
<pre class="idl">interface <dfn id="htmlbodyelement">HTMLBodyElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onafterprint" title="handler-window-onafterprint">onafterprint</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onbeforeprint" title="handler-window-onbeforeprint">onbeforeprint</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onbeforeunload" title="handler-window-onbeforeunload">onbeforeunload</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onblur" title="handler-window-onblur">onblur</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onerror" title="handler-window-onerror">onerror</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onfocus" title="handler-window-onfocus">onfocus</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onhashchange" title="handler-window-onhashchange">onhashchange</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onload" title="handler-window-onload">onload</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onmessage" title="handler-window-onmessage">onmessage</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onoffline" title="handler-window-onoffline">onoffline</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-ononline" title="handler-window-ononline">ononline</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onpopstate" title="handler-window-onpopstate">onpopstate</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onpagehide" title="handler-window-onpagehide">onpagehide</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onpageshow" title="handler-window-onpageshow">onpageshow</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onredo" title="handler-window-onredo">onredo</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onresize" title="handler-window-onresize">onresize</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onscroll" title="handler-window-onscroll">onscroll</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onstorage" title="handler-window-onstorage">onstorage</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onundo" title="handler-window-onundo">onundo</a>;
attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onunload" title="handler-window-onunload">onunload</a>;
};</pre>
</dd>
</dl><p>The <code><a href="#the-body-element">body</a></code> element <a href="rendering.html#represents">represents</a> the main
content of the document.</p><p>In conforming documents, there is only one <code><a href="#the-body-element">body</a></code>
element. The <code title="dom-document-body"><a href="dom.html#dom-document-body">document.body</a></code>
IDL attribute provides scripts with easy access to a document's
<code><a href="#the-body-element">body</a></code> element.</p><div class="impl">
<p class="note">Some DOM operations (for example, parts of the
<a href="dnd.html#dnd">drag and drop</a> model) are defined in terms of "<a href="dom.html#the-body-element-0">the
body element</a>". This refers to a particular element in the
DOM, as per the definition of the term, and not any arbitrary
<code><a href="#the-body-element">body</a></code> element.</p>
</div><p>The <code><a href="#the-body-element">body</a></code> element exposes as <a href="webappapis.html#event-handler-content-attributes">event handler
content attributes</a> a number of the <a href="webappapis.html#event-handlers">event
handlers</a> of the <code><a href="browsers.html#window">Window</a></code> object. It also mirrors
their <a href="webappapis.html#event-handler-idl-attributes">event handler IDL attributes</a>.</p><p>The <code title="handler-window-onblur"><a href="webappapis.html#handler-window-onblur">onblur</a></code>, <code title="handler-window-onerror"><a href="webappapis.html#handler-window-onerror">onerror</a></code>, <code title="handler-window-onfocus"><a href="webappapis.html#handler-window-onfocus">onfocus</a></code>, <code title="handler-window-onload"><a href="webappapis.html#handler-window-onload">onload</a></code>, and <code title="handler-window-onscroll"><a href="webappapis.html#handler-window-onscroll">onscroll</a></code> <a href="webappapis.html#event-handlers">event
handlers</a> of the <code><a href="browsers.html#window">Window</a></code> object, exposed on the
<code><a href="#the-body-element">body</a></code> element, shadow the generic <a href="webappapis.html#event-handlers">event
handlers</a> with the same names normally supported by <a href="infrastructure.html#html-elements">HTML
elements</a>.</p><p class="example">Thus, for example, a bubbling <code title="event-error">error</code> event fired on a child of <a href="dom.html#the-body-element-0">the
body element</a> of a <code><a href="infrastructure.html#document">Document</a></code> would first trigger
the <code title="handler-onerror"><a href="webappapis.html#handler-onerror">onerror</a></code> <a href="webappapis.html#event-handler-content-attributes">event handler
content attributes</a> of that element, then that of the root
<code><a href="semantics.html#the-html-element">html</a></code> element, and only <em>then</em> would it trigger
the <code title="handler-window-onerror"><a href="webappapis.html#handler-window-onerror">onerror</a></code> <a href="webappapis.html#event-handler-content-attributes" title="event handler content attributes">event handler content
attribute</a> on the <code><a href="#the-body-element">body</a></code> element. This is because
the event would bubble from the target, to the <code><a href="#the-body-element">body</a></code>, to
the <code><a href="semantics.html#the-html-element">html</a></code>, to the <code><a href="infrastructure.html#document">Document</a></code>, to the
<code><a href="browsers.html#window">Window</a></code>, and the <a href="webappapis.html#event-handlers" title="event handlers">event
handler</a> on the <code><a href="#the-body-element">body</a></code> is watching the
<code><a href="browsers.html#window">Window</a></code> not the <code><a href="#the-body-element">body</a></code>. A regular event
listener attached to the <code><a href="#the-body-element">body</a></code> using <code title="">addEventListener()</code>, however, would fire when the
event bubbled through the <code><a href="#the-body-element">body</a></code> and not when it reaches
the <code><a href="browsers.html#window">Window</a></code> object.</p><div class="example">
<p>This page updates an indicator to show whether or not the user
is online:</p>
<pre><!DOCTYPE HTML>
<html>
<head>
<title>Online or offline?</title>
<script>
function update(online) {
document.getElementById('status').textContent =
online ? 'Online' : 'Offline';
}
</script>
</head>
<body ononline="update(true)"
onoffline="update(false)"
onload="update(navigator.onLine)">
<p>You are: <span id="status">(Unknown)</span></p>
</body>
</html></pre>
</div><h4 id="the-section-element"><span class="secno">4.4.2 </span>The <dfn><code>section</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dd><a href="content-models.html#sectioning-content">Sectioning content</a>.</dd>
<dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element can be used:</dt>
<dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
<dt>Content model:</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dt>Content attributes:</dt>
<dd><a href="elements.html#global-attributes">Global attributes</a></dd>
<dt>DOM interface:</dt>
<dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
</dl><p>The <code><a href="#the-section-element">section</a></code> element <a href="rendering.html#represents">represents</a> a
generic section of a document or application. A section, in this
context, is a thematic grouping of content, typically with a
heading.</p><p class="example">Examples of sections would be chapters, the
various tabbed pages in a tabbed dialog box, or the numbered
sections of a thesis. A Web site's home page could be split into
sections for an introduction, news items, and contact
information.</p><p class="note">Authors are encouraged to use the
<code><a href="#the-article-element">article</a></code> element instead of the <code><a href="#the-section-element">section</a></code>
element when it would make sense to syndicate the contents of the
element.</p><p class="note" id="use-div-for-wrappers">The <code><a href="#the-section-element">section</a></code>
element is not a generic container element. When an element is
needed for styling purposes or as a convenience for scripting,
authors are encouraged to use the <code><a href="grouping-content.html#the-div-element">div</a></code> element
instead. A general rule is that the <code><a href="#the-section-element">section</a></code> element is
appropriate only if the element's contents would be listed
explicitly in the document's <a href="#outline">outline</a>.</p><div class="example">
<p>In the following example, we see an article (part of a larger
Web page) about apples, containing two short sections.</p>
<pre><article>
<hgroup>
<h1>Apples</h1>
<h2>Tasty, delicious fruit!</h2>
</hgroup>
<p>The apple is the pomaceous fruit of the apple tree.</p>
<section>
<h1>Red Delicious</h1>
<p>These bright red apples are the most common found in many
supermarkets.</p>
</section>
<section>
<h1>Granny Smith</h1>
<p>These juicy, green apples make a great filling for
apple pies.</p>
</section>
</article></pre>
<p>Notice how the use of <code><a href="#the-section-element">section</a></code> means that the author
can use <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code> elements throughout, without having to
worry about whether a particular section is at the top level, the
second level, the third level, and so on.</p>
</div><div class="example">
<p>Here is a graduation programme with two sections, one for the
list of people graduating, and one for the description of the
ceremony.</p>
<pre><!DOCTYPE Html>
<Html
><Head
><Title
>Graduation Ceremony Summer 2022</Title
></Head
><Body
><H1
>Graduation</H1
><Section
><H1
>Ceremony</H1
><P
>Opening Procession</P
><P
>Speech by Validactorian</P
><P
>Speech by Class President</P
><P
>Presentation of Diplomas</P
><P
>Closing Speech by Headmaster</P
></Section
><Section
><H1
>Graduates</H1
><Ul
><Li
>Molly Carpenter</Li
><Li
>Anastasia Luccio</Li
><Li
>Ebenezar McCoy</Li
><Li
>Karrin Murphy</Li
><Li
>Thomas Raith</Li
><Li
>Susan Rodriguez</Li
></Ul
></Section
></Body
></Html></pre>
</div><h4 id="the-nav-element"><span class="secno">4.4.3 </span>The <dfn><code>nav</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dd><a href="content-models.html#sectioning-content">Sectioning content</a>.</dd>
<dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element can be used:</dt>
<dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
<dt>Content model:</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dt>Content attributes:</dt>
<dd><a href="elements.html#global-attributes">Global attributes</a></dd>
<dt>DOM interface:</dt>
<dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
</dl><p>The <code><a href="#the-nav-element">nav</a></code> element <a href="rendering.html#represents">represents</a> a section of
a page that links to other pages or to parts within the page: a
section with navigation links.</p><p class="note">Not all groups of links on a page need to be in a
<code><a href="#the-nav-element">nav</a></code> element — the element is primarily intended
for sections that consist of major navigation blocks. In particular,
it is common for footers to have a short list of links to various
pages of a site, such as the terms of service, the home page, and a
copyright page. The <code><a href="#the-footer-element">footer</a></code> element alone is sufficient
for such cases; while a <code><a href="#the-nav-element">nav</a></code> element can be used in such
cases, it is usually unnecessary.</p><p class="note">User agents (such as screen readers) that are
targeted at users who can benefit from navigation information being
omitted in the initial rendering, or who can benefit from navigation
information being immediately available, can use this element as a
way to determine what content on the page to initially skip and/or
provide on request.</p><div class="example">
<p>In the following example, the page has several places where
links are present, but only one of those places is considered a
navigation section.</p>
<pre><body>
<header>
<h1>Wake up sheeple!</h1>
<p><a href="news.html">News</a> -
<a href="blog.html">Blog</a> -
<a href="forums.html">Forums</a></p>
<p>Last Modified: <time>2009-04-01</time></p>
<nav>
<h1>Navigation</h1>
<ul>
<li><a href="articles.html">Index of all articles</a></li>
<li><a href="today.html">Things sheeple need to wake up for today</a></li>
<li><a href="successes.html">Sheeple we have managed to wake</a></li>
</ul>
</nav>
</header>
<div>
<article>
<header>
<h1>My Day at the Beach</h1>
</header>
<div>
<p>Today I went to the beach and had a lot of fun.</p>
<em>...more content...</em>
</div>
<footer>
<p>Posted <time pubdate="" datetime="2009-10-10T14:36-08:00">Thursday</time>.</p>
</footer>
</article>
<em>...more blog posts...</em>
</div>
<footer>
<p>Copyright © 2006 The Example Company</p>
<p><a href="about.html">About</a> -
<a href="policy.html">Privacy Policy</a> -
<a href="contact.html">Contact Us</a></p>
</footer>
</body></pre>
<p>Notice the <code><a href="grouping-content.html#the-div-element">div</a></code> elements being used to wrap all the
contents of the page other than the header and footer, and all the
contents of the blog entry other than its header and footer.</p>
</div><div class="example">
<p>In the following example, there are two <code><a href="#the-nav-element">nav</a></code>
elements, one for primary navigation around the site, and one for
secondary navigation around the page itself.</p>
<pre><body>
<h1>The Wiki Center Of Exampland</h1>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/events">Current Events</a></li>
<em>...more...</em>
</ul>
</nav>
<article>
<header>
<h1>Demos in Exampland</h1>
<p>Written by A. N. Other.</p>
</header>
<nav>
<ul>
<li><a href="#public">Public demonstrations</a></li>
<li><a href="#destroy">Demolitions</a></li>
<em>...more...</em>
</ul>
</nav>
<div>
<section id="public">
<h1>Public demonstrations</h1>
<p><em>...more...</em></p>
</section>
<section id="destroy">
<h1>Demolitions</h1>
<p><em>...more...</em></p>
</section>
<em>...more...</em>
</div>
<footer>
<p><a href="?edit">Edit</a> | <a href="?delete">Delete</a> | <a href="?Rename">Rename</a></p>
</footer>
</article>
<footer>
<p><small>© copyright 1998 Exampland Emperor</small></p>
</footer>
</body></pre>
</div><div class="example">
<p>A <code><a href="#the-nav-element">nav</a></code> element doesn't have to contain a list, it
can contain other kinds of content as well. In this navigation
block, links are provided in prose:</p>
<pre><nav>
<h1>Navigation</h1>
<p>You are on my home page. To the north lies <a href="/blog">my
blog</a>, from whence the sounds of battle can be heard. To the east
you can see a large mountain, upon which many <a
href="/school">school papers</a> are littered. Far up thus mountain
you can spy a little figure who appears to be me, desperately
scribbling a <a href="/school/thesis">thesis</a>.</p>
<p>To the west are several exits. One fun-looking exit is labeled <a
href="http://games.example.com/">"games"</a>. Another more
boring-looking exit is labeled <a
href="http://isp.example.net/">ISP™</a>.</p>
<p>To the south lies a dark and dank <a href="/about">contacts
page</a>. Cobwebs cover its disused entrance, and at one point you
see a rat run quickly out of the page.</p>
</nav></pre>
</div><h4 id="the-article-element"><span class="secno">4.4.4 </span>The <dfn><code>article</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dd><a href="content-models.html#sectioning-content">Sectioning content</a>.</dd>
<dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element can be used:</dt>
<dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
<dt>Content model:</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dt>Content attributes:</dt>
<dd><a href="elements.html#global-attributes">Global attributes</a></dd>
<dt>DOM interface:</dt>
<dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
</dl><p>The <code><a href="#the-article-element">article</a></code> element <a href="rendering.html#represents">represents</a> a
self-contained composition in a document, page, application, or site
and that is, in principle, independently distributable or reusable,
e.g. in syndication. This could be a forum post, a magazine or
newspaper article, a blog entry, a user-submitted comment, an
interactive widget or gadget, or any other independent item of
content.</p><p>When <code><a href="#the-article-element">article</a></code> elements are nested, the inner
<code><a href="#the-article-element">article</a></code> elements represent articles that are in
principle related to the contents of the outer article. For
instance, a blog entry on a site that accepts user-submitted
comments could represent the comments as <code><a href="#the-article-element">article</a></code>
elements nested within the <code><a href="#the-article-element">article</a></code> element for the blog
entry.</p><p>Author information associated with an <code><a href="#the-article-element">article</a></code>
element (q.v. the <code><a href="#the-address-element">address</a></code> element) does not apply to
nested <code><a href="#the-article-element">article</a></code> elements.</p><p class="note">When used specifically with content to be
redistributed in syndication, the <code><a href="#the-article-element">article</a></code> element is
similar in purpose to the <code title="">entry</code> element in
Atom. <a href="references.html#refsATOM">[ATOM]</a>
</p><p class="note">The <code><a href="text-level-semantics.html#the-time-element">time</a></code> element's <code title="attr-time-pubdate"><a href="text-level-semantics.html#attr-time-pubdate">pubdate</a></code> attribute can be used to
provide the publication date for an <code><a href="#the-article-element">article</a></code>
element.</p><div class="example" id="article-example">
<p>This example shows a blog post using the <code><a href="#the-article-element">article</a></code>
element:</p>
<pre><article>
<header>
<h1>The Very First Rule of Life</h1>
<p><time pubdate datetime="2009-10-09T14:28-08:00"></time></p>
</header>
<p>If there's a microphone anywhere near you, assume it's hot and
sending whatever you're saying to the world. Seriously.</p>
<p><em>...</em></p>
<footer>
<a href="?comments=1">Show comments...</a>
</footer>
</article></pre>
<p>Here is that same blog post, but showing some of the comments:</p>
<pre><article>
<header>
<h1>The Very First Rule of Life</h1>
<p><time pubdate datetime="2009-10-09T14:28-08:00"></time></p>
</header>
<p>If there's a microphone anywhere near you, assume it's hot and
sending whatever you're saying to the world. Seriously.</p>
<p><em>...</em></p>
<section>
<h1>Comments</h1>
<article>
<footer>
<p>Posted by: George Washington</p>
<p><time pubdate datetime="2009-10-10T19:10-08:00"></time></p>
</footer>
<p>Yeah! Especially when talking about your lobbyist friends!</p>
</article>
<article>
<footer>
<p>Posted by: George Hammond</p>
<p><time pubdate datetime="2009-10-10T19:15-08:00"></time></p>
</footer>
<p>Hey, you have the same first name as me.</p>
</article>
</section>
</article></pre>
<p>Notice the use of <code><a href="#the-footer-element">footer</a></code> to give the information
for each comment (such as who wrote it and when): the
<code><a href="#the-footer-element">footer</a></code> element <em>can</em> appear at the start of its
section when appropriate, such as in this case. (Using
<code><a href="#the-header-element">header</a></code> in this case wouldn't be wrong either; it's
mostly a matter of authoring preference.)</p>
</div><h4 id="the-aside-element"><span class="secno">4.4.5 </span>The <dfn><code>aside</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dd><a href="content-models.html#sectioning-content">Sectioning content</a>.</dd>
<dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element can be used:</dt>
<dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
<dt>Content model:</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dt>Content attributes:</dt>
<dd><a href="elements.html#global-attributes">Global attributes</a></dd>
<dt>DOM interface:</dt>
<dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
</dl><p>The <code><a href="#the-aside-element">aside</a></code> element <a href="rendering.html#represents">represents</a> a section
of a page that consists of content that is tangentially related to
the content around the <code><a href="#the-aside-element">aside</a></code> element, and which could
be considered separate from that content. Such sections are often
represented as sidebars in printed typography.</p><p>The element can be used for typographical effects like pull
quotes or sidebars, for advertising, for groups of <code><a href="#the-nav-element">nav</a></code>
elements, and for other content that is considered separate from the
main content of the page.</p><p class="note">It's not appropriate to use the <code><a href="#the-aside-element">aside</a></code>
element just for parentheticals, since those are part of the main
flow of the document.</p><div class="example">
<p>The following example shows how an aside is used to mark up
background material on Switzerland in a much longer news story on
Europe.</p>
<pre><aside>
<h1>Switzerland</h1>
<p>Switzerland, a land-locked country in the middle of geographic
Europe, has not joined the geopolitical European Union, though it is
a signatory to a number of European treaties.</p>
</aside></pre>
</div><div class="example">
<p>The following example shows how an aside is used to mark up
a pull quote in a longer article.</p>
<pre>...
<p>He later joined a large company, continuing on the same work.
<q>I love my job. People ask me what I do for fun when I'm not at
work. But I'm paid to do my hobby, so I never know what to
answer. Some people wonder what they would do if they didn't have to
work... but I know what I would do, because I was unemployed for a
year, and I filled that time doing exactly what I do now.</q></p>
<aside>
<q> People ask me what I do for fun when I'm not at work. But I'm
paid to do my hobby, so I never know what to answer. </q>
</aside>
<p>Of course his work — or should that be hobby? —
isn't his only passion. He also enjoys other pleasures.</p>
...</pre>
</div><div class="example">
<p>The following extract shows how <code><a href="#the-aside-element">aside</a></code> can be used
for blogrolls and other side content on a blog:</p>
<pre><body>
<header>
<h1>My wonderful blog</h1>
<p>My tagline</p>
</header>
<aside>
<!-- <em>this aside contains two sections that are tangentially related
to the page, namely, links to other blogs, and links to blog posts
from this blog</em> -->
<nav>
<h1>My blogroll</h1>
<ul>
<li><a href="http://blog.example.com/">Example Blog</a>
</ul>
</nav>
<nav>
<h1>Archives</h1>
<ol reversed>
<li><a href="/last-post">My last post</a>
<li><a href="/first-post">My first post</a>
</ol>
</nav>
</aside>
<aside>
<!-- <em>this aside is tangentially related to the page also, it
contains twitter messages from the blog author</em> -->
<h1>Twitter Feed</h1>
<blockquote cite="http://twitter.example.net/t31351234">
I'm on vacation, writing my blog.
</blockquote>
<blockquote cite="http://twitter.example.net/t31219752">
I'm going to go on vacation soon.
</blockquote>
</aside>
<article>
<!-- <em>this is a blog post</em> -->
<h1>My last post</h1>
<p>This is my last post.</p>
<footer>
<p><a href="/last-post" rel=bookmark>Permalink</a>
</footer>
</article>
<article>
<!-- <em>this is also a blog post</em> -->
<h1>My first post</h1>
<p>This is my first post.</p>
<aside>
<!-- <em>this aside is about the blog post, since it's inside the
<article> element; it would be wrong, for instance, to put the
blogroll here, since the blogroll isn't really related to this post
specifically, only to the page as a whole</em> -->
<h1>Posting</h1>
<p>While I'm thinking about it, I wanted to say something about
posting. Posting is fun!</p>
</aside>
<footer>
<p><a href="/first-post" rel=bookmark>Permalink</a>
</footer>
</article>
<footer>
<nav>
<a href="/archives">Archives</a> —
<a href="/about">About me</a> —
<a href="/copyright">Copyright</a>
</nav>
</footer>
</body></pre>
</div><h4 id="the-h1-h2-h3-h4-h5-and-h6-elements"><span class="secno">4.4.6 </span>The <dfn id="the-h1-element"><code>h1</code></dfn>, <dfn id="the-h2-element"><code>h2</code></dfn>, <dfn id="the-h3-element"><code>h3</code></dfn>, <dfn id="the-h4-element"><code>h4</code></dfn>, <dfn id="the-h5-element"><code>h5</code></dfn>, and <dfn id="the-h6-element"><code>h6</code></dfn> elements</h4><dl class="element"><dt>Categories</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dd><a href="content-models.html#heading-content">Heading content</a>.</dd>
<dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element can be used:</dt>
<dd>As a child of an <code><a href="#the-hgroup-element">hgroup</a></code> element.</dd>
<dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
<dt>Content model:</dt>
<dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
<dt>Content attributes:</dt>
<dd><a href="elements.html#global-attributes">Global attributes</a></dd>
<dt>DOM interface:</dt>
<dd>
<pre class="idl">interface <dfn id="htmlheadingelement">HTMLHeadingElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {};</pre>
</dd>
</dl><p>These elements <a href="rendering.html#represents" title="represents">represent</a> headings
for their sections.</p><p>The semantics and meaning of these elements are defined in the
section on <a href="#headings-and-sections">headings and sections</a>.</p><p>These elements have a <dfn id="rank">rank</dfn> given by the number in
their name. The <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code> element is said to have the highest
rank, the <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> element has the lowest rank, and two
elements with the same name have equal rank.</p><div class="example">
<p>These two snippets are equivalent:</p>
<pre><body>
<h1>Let's call it a draw(ing surface)</h1>
<h2>Diving in</h2>
<h2>Simple shapes</h2>
<h2>Canvas coordinates</h2>
<h3>Canvas coordinates diagram</h3>
<h2>Paths</h2>
</body></pre>
<pre><body>
<h1>Let's call it a draw(ing surface)</h1>
<section>
<h1>Diving in</h1>
</section>
<section>
<h1>Simple shapes</h1>
</section>
<section>
<h1>Canvas coordinates</h1>
<section>
<h1>Canvas coordinates diagram</h1>
</section>
</section>
<section>
<h1>Paths</h1>
</section>
</body></pre>
</div><h4 id="the-hgroup-element"><span class="secno">4.4.7 </span>The <dfn><code>hgroup</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dd><a href="content-models.html#heading-content">Heading content</a>.</dd>
<dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element can be used:</dt>
<dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
<dt>Content model:</dt>
<dd>One or more <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>, <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code>, <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h3</a></code>, <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h4</a></code>, <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h5</a></code>, and/or <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> elements.</dd>
<dt>Content attributes:</dt>
<dd><a href="elements.html#global-attributes">Global attributes</a></dd>
<dt>DOM interface:</dt>
<dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
</dl><p>The <code><a href="#the-hgroup-element">hgroup</a></code> element <a href="rendering.html#represents">represents</a> the
heading of a section. The element is used to group a set of
<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>–<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> elements when the heading has
multiple levels, such as subheadings, alternative titles, or
taglines.</p><p>For the purposes of document summaries, outlines, and the like,
the text of <code><a href="#the-hgroup-element">hgroup</a></code> elements is defined to be the text
of the highest <a href="#rank" title="rank">ranked</a>
<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>–<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> element descendant of the
<code><a href="#the-hgroup-element">hgroup</a></code> element, if there are any such elements, and the
first such element if there are multiple elements with that
<a href="#rank">rank</a>. If there are no such elements, then the text of
the <code><a href="#the-hgroup-element">hgroup</a></code> element is the empty string.</p><p>Other elements of <a href="content-models.html#heading-content">heading content</a> in the
<code><a href="#the-hgroup-element">hgroup</a></code> element indicate subheadings or subtitles.</p><p>The <a href="#rank">rank</a> of an <code><a href="#the-hgroup-element">hgroup</a></code> element is the
rank of the highest-ranked <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>–<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code>
element descendant of the <code><a href="#the-hgroup-element">hgroup</a></code> element, if there are
any such elements, or otherwise the same as for an <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>
element (the highest rank).</p><p>The section on <a href="#headings-and-sections">headings and sections</a>
defines how <code><a href="#the-hgroup-element">hgroup</a></code> elements are assigned to individual
sections.</p><div class="example">
<p>Here are some examples of valid headings. In each case, the
emphasized text represents the text that would be used as the
heading in an application extracting heading data and ignoring
subheadings.</p>
<pre><hgroup>
<h1><strong>The reality dysfunction</strong></h1>
<h2>Space is not the only void</h2>
</hgroup></pre>
<pre><hgroup>
<h1><strong>Dr. Strangelove</strong></h1>
<h2>Or: How I Learned to Stop Worrying and Love the Bomb</h2>
</hgroup></pre>
<p>The point of using <code><a href="#the-hgroup-element">hgroup</a></code> in these examples is to
mask the <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code> element (which acts as a secondary title)
from the <a href="#outline">outline</a> algorithm.</p>
</div><h4 id="the-header-element"><span class="secno">4.4.8 </span>The <dfn><code>header</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element can be used:</dt>
<dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
<dt>Content model:</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>, but with no <code><a href="#the-header-element">header</a></code> or
<code><a href="#the-footer-element">footer</a></code> element descendants.</dd>
<dt>Content attributes:</dt>
<dd><a href="elements.html#global-attributes">Global attributes</a></dd>
<dt>DOM interface:</dt>
<dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
</dl><p>The <code><a href="#the-header-element">header</a></code> element <a href="rendering.html#represents">represents</a> a group
of introductory or navigational aids.</p><p class="note">A <code><a href="#the-header-element">header</a></code> element is intended to usually
contain the section's heading (an
<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>–<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> element or an
<code><a href="#the-hgroup-element">hgroup</a></code> element), but this is not required. The
<code><a href="#the-header-element">header</a></code> element can also be used to wrap a section's
table of contents, a search form, or any relevant logos.</p><div class="example">
<p>Here are some sample headers. This first one is for a game:</p>
<pre><header>
<p>Welcome to...</p>
<h1>Voidwars!</h1>
</header></pre>
<p>The following snippet shows how the element can be used to mark
up a specification's header:</p>
<pre><header>
<hgroup>
<h1>Scalable Vector Graphics (SVG) 1.2</h1>
<h2>W3C Working Draft 27 October 2004</h2>
</hgroup>
<dl>
<dt>This version:</dt>
<dd><a href="http://www.w3.org/TR/2004/WD-SVG12-20041027/">http://www.w3.org/TR/2004/WD-SVG12-20041027/</a></dd>
<dt>Previous version:</dt>
<dd><a href="http://www.w3.org/TR/2004/WD-SVG12-20040510/">http://www.w3.org/TR/2004/WD-SVG12-20040510/</a></dd>
<dt>Latest version of SVG 1.2:</dt>
<dd><a href="http://www.w3.org/TR/SVG12/">http://www.w3.org/TR/SVG12/</a></dd>
<dt>Latest SVG Recommendation:</dt>
<dd><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></dd>
<dt>Editor:</dt>
<dd>Dean Jackson, W3C, <a href="mailto:dean@w3.org">dean@w3.org</a></dd>
<dt>Authors:</dt>
<dd>See <a href="#authors">Author List</a></dd>
</dl>
<p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notic <em>...</em>
</header></pre>
</div><p class="note">The <code><a href="#the-header-element">header</a></code> element is not
<a href="content-models.html#sectioning-content">sectioning content</a>; it doesn't introduce a new
section.</p><div class="example">
<p>In this example, the page has a page heading given by the
<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code> element, and two subsections whose headings are
given by <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code> elements. The content after the
<code><a href="#the-header-element">header</a></code> element is still part of the last subsection
started in the <code><a href="#the-header-element">header</a></code> element, because the
<code><a href="#the-header-element">header</a></code> element doesn't take part in the
<a href="#outline">outline</a> algorithm.</p>
<pre><body>
<header>
<h1>Little Green Guys With Guns</h1>
<nav>
<ul>
<li><a href="/games">Games</a>
<li><a href="/forum">Forum</a>
<li><a href="/download">Download</a>
</ul>
</nav>
<h2>Important News</h2> <!-- this starts a second subsection -->
<!-- this is part of the subsection entitled "Important News" -->
<p>To play today's games you will need to update your client.</p>
<h2>Games</h2> <!-- this starts a third subsection -->
</header>
<p>You have three active games:</p>
<!-- this is still part of the subsection entitled "Games" -->
...</pre>
</div><h4 id="the-footer-element"><span class="secno">4.4.9 </span>The <dfn><code>footer</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element can be used:</dt>
<dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
<dt>Content model:</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>, but with no <code><a href="#the-header-element">header</a></code> or
<code><a href="#the-footer-element">footer</a></code> element descendants.</dd>
<dt>Content attributes:</dt>
<dd><a href="elements.html#global-attributes">Global attributes</a></dd>
<dt>DOM interface:</dt>
<dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
</dl><p>The <code><a href="#the-footer-element">footer</a></code> element <a href="rendering.html#represents">represents</a> a footer
for its nearest ancestor <a href="content-models.html#sectioning-content">sectioning content</a> or
<a href="#sectioning-root">sectioning root</a> element. A footer typically contains
information about its section such as who wrote it, links to related
documents, copyright data, and the like.</p><p>When the <code><a href="#the-footer-element">footer</a></code> element contains entire sections,
they <a href="rendering.html#represents" title="represents">represent</a> appendices, indexes,
long colophons, verbose license agreements, and other such
content.</p><p class="note">Contact information for the author or editor of a
section belongs in an <code><a href="#the-address-element">address</a></code> element, possibly itself
inside a <code><a href="#the-footer-element">footer</a></code>.</p><p>Footers don't necessarily have to appear at the <em>end</em> of a
section, though they usually do.</p><p>When the nearest ancestor <a href="content-models.html#sectioning-content">sectioning content</a> or
<a href="#sectioning-root">sectioning root</a> element is <a href="dom.html#the-body-element-0">the body
element</a>, then it applies to the whole page.</p><p class="note">The <code><a href="#the-footer-element">footer</a></code> element is not
<a href="content-models.html#sectioning-content">sectioning content</a>; it doesn't introduce a new
section.</p><div class="example">
<p>Here is a page with two footers, one at the top and one at the
bottom, with the same content:</p>
<pre><body>
<footer><a href="../">Back to index...</a></footer>
<hgroup>
<h1>Lorem ipsum</h1>
<h2>The ipsum of all lorems</h2>
</hgroup>
<p>A dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.</p>
<footer><a href="../">Back to index...</a></footer>
</body></pre>
</div><div class="example">
<p>Here is an example which shows the <code><a href="#the-footer-element">footer</a></code> element
being used both for a site-wide footer and for a section
footer.</p>
<pre><!DOCTYPE HTML>
<HTML><HEAD>
<TITLE>The Ramblings of a Scientist</TITLE>
<BODY>
<H1>The Ramblings of a Scientist</H1>
<ARTICLE>
<H1>Episode 15</H1>
<VIDEO SRC="/fm/015.ogv" CONTROLS PRELOAD>
<P><A HREF="/fm/015.ogv">Download video</A>.</P>
</VIDEO>
<FOOTER> <!-- footer for article -->
<P>Published <TIME PUBDATE DATETIME="2009-10-21T18:26-07:00"></TIME></P>
</FOOTER>
</ARTICLE>
<ARTICLE>
<H1>My Favorite Trains</H1>
<P>I love my trains. My favorite train of all time is a Köf.</P>
<P>It is fun to see them pull some coal cars because they look so
dwarfed in comparison.</P>
<FOOTER> <!-- footer for article -->
<P>Published <TIME PUBDATE DATETIME="2009-09-15T14:54-07:00"></TIME></P>
</FOOTER>
</ARTICLE>
<FOOTER> <!-- site wide footer -->
<NAV>
<P><A HREF="/credits.html">Credits</A> —
<A HREF="/tos.html">Terms of Service</A> —
<A HREF="/index.html">Blog Index</A></P>
</NAV>
<P>Copyright © 2009 Gordon Freeman</P>
</FOOTER>
</BODY>
</HTML></pre>
</div><div class="example">
<p>Some site designs have what is sometimes referred to as "fat
footers" — footers that contain a lot of material, including
images, links to other articles, links to pages for sending
feedback, special offers... in some ways, a whole "front page" in
the footer.</p>
<p>This fragment shows the bottom of a page on a site with a "fat
footer":</p>
<pre>...
<footer>
<nav>
<section>
<h1>Articles</h1>
<p><img src="somersaults.jpeg" alt=""> Go to the gym with
our somersaults class! Our teacher Jim takes you through the paces
in this two-part article. <a href="articles/somersaults/1">Part
1</a> · <a href="articles/somersaults/1">Part 2</a></p>
<p><img src="kindplus.jpeg"> Tired of walking on the edge of
a clif<!-- sic -->? Our guest writer Lara shows you how to bumble
your way through the bars. <a href="articles/kindplus/1">Read
more...</a></p>
<p><img src="crisps.jpeg"> The chips are down, now all
that's left is a potato. What can you do with it? <a
href="articles/crisps/1">Read more...</a></p>
</section>
<ul>
<li> <a href="/about">About us...</a>
<li> <a href="/feedback">Send feedback!</a>
<li> <a href="/sitemap">Sitemap</a>
</ul>
</nav>
<p><small>Copyright © 2015 The Snacker —
<a href="/tos">Terms of Service</a></small></p>
</footer>
</body></pre>
</div><h4 id="the-address-element"><span class="secno">4.4.10 </span>The <dfn><code>address</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
<dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element can be used:</dt>
<dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
<dt>Content model:</dt>
<dd><a href="content-models.html#flow-content">Flow content</a>, but with no <a href="content-models.html#heading-content">heading
content</a> descendants, no <a href="content-models.html#sectioning-content">sectioning content</a>
descendants, and no <code><a href="#the-header-element">header</a></code>, <code><a href="#the-footer-element">footer</a></code>, or
<code><a href="#the-address-element">address</a></code> element descendants.</dd>
<dt>Content attributes:</dt>
<dd><a href="elements.html#global-attributes">Global attributes</a></dd>
<dt>DOM interface:</dt>
<dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
</dl><p>The <code><a href="#the-address-element">address</a></code> element <a href="rendering.html#represents">represents</a> the
contact information for its nearest <code><a href="#the-article-element">article</a></code> or
<code><a href="#the-body-element">body</a></code> element ancestor. If that is <a href="dom.html#the-body-element-0">the body
element</a>, then the contact information applies to the document
as a whole.</p><div class="example">
<p>For example, a page at the W3C Web site related to HTML might
include the following contact information:</p>
<pre><ADDRESS>
<A href="../People/Raggett/">Dave Raggett</A>,
<A href="../People/Arnaud/">Arnaud Le Hors</A>,
contact persons for the <A href="Activity">W3C HTML Activity</A>
</ADDRESS></pre>
</div><p>The <code><a href="#the-address-element">address</a></code> element must not be used to represent
arbitrary addresses (e.g. postal addresses), unless those addresses
are in fact the relevant contact information. (The <code><a href="grouping-content.html#the-p-element">p</a></code>
element is the appropriate element for marking up postal addresses
in general.)</p><p>The <code><a href="#the-address-element">address</a></code> element must not contain information
other than contact information.</p><div class="example">
<p>For example, the following is non-conforming use of the
<code><a href="#the-address-element">address</a></code> element:</p>
<pre class="bad"><ADDRESS>Last Modified: 1999/12/24 23:37:50</ADDRESS></pre>
</div><p>Typically, the <code><a href="#the-address-element">address</a></code> element would be included
along with other information in a <code><a href="#the-footer-element">footer</a></code> element.</p><div class="impl">
<p>The contact information for a node <var title="">node</var> is a
collection of <code><a href="#the-address-element">address</a></code> elements defined by the first
applicable entry from the following list:</p>
<dl class="switch"><dt>If <var title="">node</var> is an <code><a href="#the-article-element">article</a></code> element</dt>
<dt>If <var title="">node</var> is a <code><a href="#the-body-element">body</a></code> element</dt>
<dd>
<p>The contact information consists of all the
<code><a href="#the-address-element">address</a></code> elements that have <var title="">node</var>
as an ancestor and do not have another <code><a href="#the-body-element">body</a></code> or
<code><a href="#the-article-element">article</a></code> element ancestor that is a descendant of <var title="">node</var>.</p>
</dd>
<dt>If <var title="">node</var> has an ancestor element that is an <code><a href="#the-article-element">article</a></code> element</dt>
<dt>If <var title="">node</var> has an ancestor element that is a <code><a href="#the-body-element">body</a></code> element</dt>
<dd>
<p>The contact information of <var title="">node</var> is the same
as the contact information of the nearest <code><a href="#the-article-element">article</a></code> or
<code><a href="#the-body-element">body</a></code> element ancestor, whichever is nearest.</p>
</dd>
<dt>If <var title="">node</var>'s <code><a href="infrastructure.html#document">Document</a></code> has <a href="dom.html#the-body-element-0" title="the body element">a body element</a></dt>
<dd>
<p>The contact information of <var title="">node</var> is the same
as the contact information of <a href="dom.html#the-body-element-0">the body element</a> of the
<code><a href="infrastructure.html#document">Document</a></code>.</p>
</dd>
<dt>Otherwise</dt>
<dd>
<p>There is no contact information for <var title="">node</var>.</p>
</dd>
</dl><p>User agents may expose the contact information of a node to the
user, or use it for other purposes, such as indexing sections based
on the sections' contact information.</p>
</div><div class="example">
<p>In this example the footer contains contact information and a
copyright notice.</p>
<pre><footer>
<address>
For more details, contact
<a href="mailto:js@example.com">John Smith</a>.
</address>
<p><small>© copyright 2038 Example Corp.</small></p>
</footer></pre>
</div><h4 id="headings-and-sections"><span class="secno">4.4.11 </span><dfn>Headings and sections</dfn></h4><p>The <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>–<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> elements and the
<code><a href="#the-hgroup-element">hgroup</a></code> element are headings.</p><p>The first element of <a href="content-models.html#heading-content">heading content</a> in an element
of <a href="content-models.html#sectioning-content">sectioning content</a> <a href="rendering.html#represents">represents</a> the
heading for that section. Subsequent headings of equal or higher
<a href="#rank">rank</a> start new (implied) sections, headings of lower
<a href="#rank">rank</a> start implied subsections that are part of the
previous one. In both cases, the element <a href="rendering.html#represents">represents</a> the
heading of the implied section.</p><p>Certain elements are said to be <dfn id="sectioning-root" title="sectioning
root">sectioning roots</dfn>, including <code><a href="grouping-content.html#the-blockquote-element">blockquote</a></code> and
<code><a href="tabular-data.html#the-td-element">td</a></code> elements. These elements can have their own
outlines, but the sections and headings inside these elements do not
contribute to the outlines of their ancestors.</p><ul class="brief category-list"><li><code><a href="grouping-content.html#the-blockquote-element">blockquote</a></code></li>
<li><code><a href="#the-body-element">body</a></code></li>
<li><code><a href="interactive-elements.html#the-details-element">details</a></code></li>
<li><code><a href="forms.html#the-fieldset-element">fieldset</a></code></li>
<li><code><a href="grouping-content.html#the-figure-element">figure</a></code></li>
<li><code><a href="tabular-data.html#the-td-element">td</a></code></li>
</ul><p><a href="content-models.html#sectioning-content">Sectioning content</a> elements are always considered
subsections of their nearest ancestor <a href="#sectioning-root">sectioning root</a>
or their nearest ancestor element of <a href="content-models.html#sectioning-content">sectioning
content</a>, whichever is nearest, regardless of what implied
sections other headings may have created.</p><div class="example">
<p>For the following fragment:</p>
<pre><body>
<h1>Foo</h1>
<h2>Bar</h2>
<blockquote>
<h3>Bla</h3>
</blockquote>
<p>Baz</p>
<h2>Quux</h2>
<section>
<h3>Thud</h3>
</section>
<p>Grunt</p>
</body></pre>
<p>...the structure would be:</p>
<ol><li>
Foo (heading of explicit <code><a href="#the-body-element">body</a></code> section, containing the "Grunt" paragraph)
<ol><li>
Bar (heading starting implied section, containing a block quote and the "Baz" paragraph)
</li>
<li>
Quux (heading starting implied section with no content other than the heading itself)
</li>
<li>
Thud (heading of explicit <code><a href="#the-section-element">section</a></code> section)
</li>
</ol></li>
</ol><p>Notice how the <code><a href="#the-section-element">section</a></code> ends the earlier implicit
section so that a later paragraph ("Grunt") is back at the top
level.</p>
</div><p>Sections may contain headings of any <a href="#rank">rank</a>, but
authors are strongly encouraged to either use only <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>
elements, or to use elements of the appropriate <a href="#rank">rank</a>
for the section's nesting level.</p><p>Authors are also encouraged to explicitly wrap sections in
elements of <a href="content-models.html#sectioning-content">sectioning content</a>, instead of relying on
the implicit sections generated by having multiple headings in one
element of <a href="content-models.html#sectioning-content">sectioning content</a>.</p><div class="example">
<p>For example, the following is correct:</p>
<pre><body>
<h4>Apples</h4>
<p>Apples are fruit.</p>
<section>
<h2>Taste</h2>
<p>They taste lovely.</p>
<h6>Sweet</h6>
<p>Red apples are sweeter than green ones.</p>
<h1>Color</h1>
<p>Apples come in various colors.</p>
</section>
</body></pre>
<p>However, the same document would be more clearly expressed
as:</p>
<pre><body>
<h1>Apples</h1>
<p>Apples are fruit.</p>
<section>
<h2>Taste</h2>
<p>They taste lovely.</p>
<section>
<h3>Sweet</h3>
<p>Red apples are sweeter than green ones.</p>
</section>
</section>
<section>
<h2>Color</h2>
<p>Apples come in various colors.</p>
</section>
</body></pre>
<p>Both of the documents above are semantically identical and would
produce the same outline in compliant user agents.</p>
<p>This third example is also semantically identical, and might be
easier to maintain (e.g. if sections are often moved around in
editing):</p>
<pre><body>
<h1>Apples</h1>
<p>Apples are fruit.</p>
<section>
<h1>Taste</h1>
<p>They taste lovely.</p>
<section>
<h1>Sweet</h1>
<p>Red apples are sweeter than green ones.</p>
</section>
</section>
<section>
<h1>Color</h1>
<p>Apples come in various colors.</p>
</section>
</body></pre>
</div><h5 id="outlines"><span class="secno">4.4.11.1 </span>Creating an outline</h5><div class="impl">
<p>This section defines an algorithm for creating an outline for a
<a href="content-models.html#sectioning-content">sectioning content</a> element or a <a href="#sectioning-root">sectioning
root</a> element. It is defined in terms of a walk over the nodes
of a DOM tree, in tree order, with each node being visited when it
is <i>entered</i> and when it is <i>exited</i> during the walk.</p>
</div><p>The <dfn id="outline">outline</dfn> for a <a href="content-models.html#sectioning-content">sectioning content</a>
element or a <a href="#sectioning-root">sectioning root</a> element consists of a list
of one or more potentially nested <a href="#concept-section" title="concept-section">sections</a>. A <dfn id="concept-section" title="concept-section">section</dfn> is a container that
corresponds to some nodes in the original DOM tree. Each section can
have one heading associated with it, and can contain any number of
further nested sections. <span class="impl">The algorithm for the
outline also associates each node in the DOM tree with a particular
section and potentially a heading.</span> (The sections in the
outline aren't <code><a href="#the-section-element">section</a></code> elements, though some may
correspond to such elements — they are merely conceptual
sections.)</p><div class="example">
<p>The following markup fragment:</p>
<pre><body>
<h1>A</h1>
<p>B</p>
<h2>C</h2>
<p>D</p>
<h2>E</h2>
<p>F</p>
</body></pre>
<p>...results in the following outline being created for the
<code><a href="#the-body-element">body</a></code> node (and thus the entire document):</p>
<ol class="brief"><li>
<p>Section created for <code><a href="#the-body-element">body</a></code> node.</p>
<p>Associated with heading "A".</p>
<p>Also associated with paragraph "B".</p>
<p>Nested sections:</p>
<ol class="brief"><li>
<p>Section implied for first <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code> element.</p>
<p>Associated with heading "C".</p>
<p>Also associated with paragraph "D".</p>
<p>No nested sections.</p>
</li>
<li>
<p>Section implied for second <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code> element.</p>
<p>Associated with heading "E".</p>
<p>Also associated with paragraph "F".</p>
<p>No nested sections.</p>
</li>
</ol></li>
</ol></div><div class="impl">
<p>The algorithm that must be followed during a walk of a DOM
subtree rooted at a <a href="content-models.html#sectioning-content">sectioning content</a> element or a
<a href="#sectioning-root">sectioning root</a> element to determine that element's
<a href="#outline">outline</a> is as follows:</p>
<ol><li><p>Let <var title="">current outlinee</var> be null. (It holds
the element whose <a href="#outline">outline</a> is being created.)</p></li>
<li><p>Let <var title="">current section</var> be null. (It holds a
pointer to a <a href="#concept-section" title="concept-section">section</a>, so that
elements in the DOM can all be associated with a section.)</p></li>
<li><p>Create a stack to hold elements, which is used to handle
nesting. Initialize this stack to empty.</p></li>
<li>
<p>As you walk over the DOM in <a href="infrastructure.html#tree-order">tree order</a>, trigger
the first relevant step below for each element as you enter and
exit it.</p>
<dl class="switch"><dt>If you are exiting an element and that element is the element
at the top of the stack</dt>
<dd>
<p class="note">The element being exited is a <a href="content-models.html#heading-content">heading
content</a> element.</p>
<p>Pop that element from the stack.</p>
</dd>
<dt>If the top of the stack is a <a href="content-models.html#heading-content">heading content</a>
element</dt>
<dd><p>Do nothing.</p></dd>
<dt>When entering a <a href="content-models.html#sectioning-content">sectioning content</a> element or a
<a href="#sectioning-root">sectioning root</a> element</dt>
<dd>
<p>If <var title="">current outlinee</var> is not null, and the
<var title="">current section</var> has no heading, create an
implied heading and let that be the heading for the <var title="">current section</var>.</p>
<p>If <var title="">current outlinee</var> is not null, push
<var title="">current outlinee</var> onto the stack.</p>
<p>Let <var title="">current outlinee</var> be the element
that is being entered.</p>
<p>Let <var title="">current section</var> be a newly created
<a href="#concept-section" title="concept-section">section</a> for the <var title="">current outlinee</var> element.</p>
<p>Associate <var title="">current outlinee</var> with <var title="">current section</var>.</p>
<p>Let there be a new <a href="#outline">outline</a> for the new <var title="">current outlinee</var>, initialized with just the new
<var title="">current section</var> as the only <a href="#concept-section" title="concept-section">section</a> in the outline.</p>
</dd>
<dt>When exiting a <a href="content-models.html#sectioning-content">sectioning content</a> element, if
the stack is not empty</dt>
<dd>
<p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</p>
<p>Let <var title="">current section</var> be the last section
in the <a href="#outline">outline</a> of the <var title="">current
outlinee</var> element.</p>
<p>Append the <a href="#outline">outline</a> of the <a href="content-models.html#sectioning-content">sectioning
content</a> element being exited to the <var title="">current
section</var>. (This does not change which section is the last
section in the <a href="#outline">outline</a>.)</p>
</dd>
<dt>When exiting a <a href="#sectioning-root">sectioning root</a> element, if the
stack is not empty</dt>
<dd>
<p>Run these steps:</p>
<ol><li><p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</p></li>
<li><p>Let <var title="">current section</var> be the last
section in the <a href="#outline">outline</a> of the <var title="">current
outlinee</var> element.</p></li>
<li><p><i>Finding the deepest child</i>: If <var title="">current section</var> has no child sections, stop
these steps.</p></li>
<li><p>Let <var title="">current section</var> be the last
child <a href="#concept-section" title="concept-section">section</a> of the
current <var title="">current section</var>.</p></li>
<li><p>Go back to the substep labeled <i>finding the deepest
child</i>.</p></li>
</ol></dd>
<dt>When exiting a <a href="content-models.html#sectioning-content">sectioning content</a> element or a
<a href="#sectioning-root">sectioning root</a> element</dt>
<dd>
<p class="note">The <var title="">current outlinee</var> is
the element being exited.</p>
<p>Let <var title="">current section</var> be the first <a href="#concept-section" title="concept-section">section</a> in the
<a href="#outline">outline</a> of the <var title="">current outlinee</var>
element.</p>
<p>Skip to the next step in the overall set of steps. (The walk
is over.)</p>
</dd>
<dt>If the <var title="">current outlinee</var> is null</dt>
<dd><p>Do nothing.</p></dd>
<dt>When entering a <a href="content-models.html#heading-content">heading content</a> element</dt>
<dd>
<p>If the <var title="">current section</var> has no heading,
let the element being entered be the heading for the <var title="">current section</var>.</p>
<p>Otherwise, if the element being entered has a
<a href="#rank">rank</a> equal to or greater than the heading of the
last section of the <a href="#outline">outline</a> of the <var title="">current outlinee</var>, then create a new <a href="#concept-section" title="concept-section">section</a> and append it to the
<a href="#outline">outline</a> of the <var title="">current outlinee</var>
element, so that this new section is the new last section of
that outline. Let <var title="">current section</var> be that
new section. Let the element being entered be the new heading
for the <var title="">current section</var>.</p>
<p>Otherwise, run these substeps:</p>
<ol><li><p>Let <var title="">candidate section</var> be <var title="">current section</var>.</p></li>
<li><p>If the element being entered has a <a href="#rank">rank</a>
lower than the <a href="#rank">rank</a> of the heading of the <var title="">candidate section</var>, then create a new <a href="#concept-section" title="concept-section">section</a>, and append it to <var title="">candidate section</var>. (This does not change which
section is the last section in the outline.) Let <var title="">current section</var> be this new section. Let the
element being entered be the new heading for the <var title="">current section</var>. Abort these substeps.</p>
</li><li><p>Let <var title="">new candidate section</var> be the
<a href="#concept-section" title="concept-section">section</a> that contains <var title="">candidate section</var> in the <a href="#outline">outline</a> of
<var title="">current outlinee</var>.</p></li>
<li><p>Let <var title="">candidate section</var> be <var title="">new candidate section</var>.</p></li>
<li><p>Return to step 2.</p></li>
</ol><p>Push the element being entered onto the stack. (This causes
the algorithm to skip any descendants of the element.)</p>
<p class="note">Recall that <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code> has the
<em>highest</em> rank, and <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> has the lowest
rank.</p>
</dd>
<dt>Otherwise</dt>
<dd><p>Do nothing.</p></dd>
</dl><p id="associatedSection">In addition, whenever you exit a node,
after doing the steps above, if the node is not associated with a
<a href="#concept-section" title="concept-section">section</a> yet and <var title="">current section</var> is not null, associate the node
with the <a href="#concept-section" title="concept-section">section</a> <var title="">current section</var>.</p>
</li>
<li><p>If the <var title="">current outlinee</var> is null,
then there was no <a href="content-models.html#sectioning-content">sectioning content</a> element or
<a href="#sectioning-root">sectioning root</a> element in the DOM. There is no
<a href="#outline">outline</a>. Abort these steps.</p></li>
<li><p>Associate any nodes that were not associated with a <a href="#concept-section" title="concept-section">section</a> in the steps above with <var title="">current outlinee</var> as their section.</p></li>
<li><p>Associate all nodes with the heading of the <a href="#concept-section" title="concept-section">section</a> with which they are
associated, if any.</p></li>
<li><p>If <var title="">current outlinee</var> is <a href="dom.html#the-body-element-0">the body
element</a>, then the outline created for that element is the
<a href="#outline">outline</a> of the entire document.</p></li>
</ol><p>The tree of sections created by the algorithm above, or a proper
subset thereof, must be used when generating document outlines, for
example when generating tables of contents.</p>
<p>When creating an interactive table of contents, entries should
jump the user to the relevant <a href="content-models.html#sectioning-content">sectioning content</a>
element, if the <a href="#concept-section" title="concept-section">section</a> was
created for a real element in the original document, or to the
relevant <a href="content-models.html#heading-content">heading content</a> element, if the <a href="#concept-section" title="concept-section">section</a> in the tree was generated for
a heading in the above process.</p>
<p class="note">Selecting the first <a href="#concept-section" title="concept-section">section</a> of the document therefore
always takes the user to the top of the document, regardless of
where the first heading in the <code><a href="#the-body-element">body</a></code> is to be found.</p>
<p>The <dfn id="outline-depth">outline depth</dfn> of a <a href="content-models.html#heading-content">heading content</a>
element associated with a <a href="#concept-section" title="concept-section">section</a> <var title="">section</var>
is the number of <a href="#concept-section" title="concept-section">sections</a> that
are ancestors of <var title="">section</var> in the
<a href="#outline">outline</a> that <var title="">section</var> finds itself
in when the <a href="#outline" title="outline">outlines</a> of its
<code><a href="infrastructure.html#document">Document</a></code>'s elements are created, plus 1. The
<a href="#outline-depth">outline depth</a> of a <a href="content-models.html#heading-content">heading content</a> element
not associated with a <a href="#concept-section" title="concept-section">section</a>
is 1.</p>
<p>User agents should provide default headings for sections that do
not have explicit section headings.</p>
<div class="example">
<p>Consider the following snippet:</p>
<pre><body>
<nav>
<p><a href="/">Home</a></p>
</nav>
<p>Hello world.</p>
<aside>
<p>My cat is cute.</p>
</aside>
</body></pre>
<p>Although it contains no headings, this snippet has three
sections: a document (the <code><a href="#the-body-element">body</a></code>) with two subsections
(a <code><a href="#the-nav-element">nav</a></code> and an <code><a href="#the-aside-element">aside</a></code>). A user agent could
present the outline as follows:</p>
<ol class="brief"><li>Untitled document
<ol><li>Navigation</li>
<li>Sidebar</li>
</ol></li>
</ol><p>These default headings ("Untitled document", "Navigation",
"Sidebar") are not specified by this specification, and might vary
with the user's language, the page's language, the user's
preferences, the user agent implementor's preferences, etc.</p>
</div>
<div class="note">
<p>The following JavaScript function shows how the tree walk could
be implemented. The <var title="">root</var> argument is the root
of the tree to walk, and the <var title="">enter</var> and <var title="">exit</var> arguments are callbacks that are called with
the nodes as they are entered and exited. <a href="references.html#refsECMA262">[ECMA262]</a></p>
<pre>function (root, enter, exit) {
var node = root;
start: while (node) {
enter(node);
if (node.firstChild) {
node = node.firstChild;
continue start;
}
while (node) {
exit(node);
if (node.nextSibling) {
node = node.nextSibling;
continue start;
}
if (node == root)
node = null;
else
node = node.parentNode;
}
}
}</pre>
</div>
</div>
</body></html>