Annotation of html5/spec/sections.html, revision 1.5
1.1 mike 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
2: <!DOCTYPE html>
3: <!-- when publishing, change bits marked ZZZ --><html lang="en-US-x-Hixie" class="split chapter"><head><title>4.4 Sections — HTML5 </title><style type="text/css">
4: pre { margin-left: 2em; white-space: pre-wrap; }
5: h2 { margin: 3em 0 1em 0; }
6: h3 { margin: 2.5em 0 1em 0; }
7: h4 { margin: 2.5em 0 0.75em 0; }
8: h5, h6 { margin: 2.5em 0 1em; }
9: h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
10: h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
11: p { margin: 1em 0; }
12: hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
13: dl, dd { margin-top: 0; margin-bottom: 0; }
14: dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
15: dt + dt { margin-top: 0; }
16: dd dt { margin-top: 0.25em; margin-bottom: 0; }
17: dd p { margin-top: 0; }
18: dd dl + p { margin-top: 1em; }
19: dd table + p { margin-top: 1em; }
20: p + * > li, dd li { margin: 1em 0; }
21: dt, dfn { font-weight: bold; font-style: normal; }
22: dt dfn { font-style: italic; }
23: pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
24: pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
25: pre em { font-weight: bolder; font-style: normal; }
26: @media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
27: var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
28: table { border-collapse: collapse; border-style: hidden hidden none hidden; }
29: table thead, table tbody { border-bottom: solid; }
30: table tbody th:first-child { border-left: solid; }
31: table tbody th { text-align: left; }
32: table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
33: blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
34:
35: .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
36: .matrix, .matrix td { border: none; text-align: right; }
37: .matrix { margin-left: 2em; }
38: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
39: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
40: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
41:
42: .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
43: img.extra { float: right; }
44: pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; }
45: pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
46: pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
47: pre.css:first-line { color: #AAAA50; }
48: dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
49: hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
50: dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
51: dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
52: dl.domintro dd p { margin: 0.5em 0; }
53: dl.switch { padding-left: 2em; }
54: dl.switch > dt { text-indent: -1.5em; }
55: dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
56: dl.triple { padding: 0 0 0 1em; }
57: dl.triple dt, dl.triple dd { margin: 0; display: inline }
58: dl.triple dt:after { content: ':'; }
59: dl.triple dd:after { content: '\A'; white-space: pre; }
60: .diff-old { text-decoration: line-through; color: silver; background: transparent; }
61: .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
62: a .diff-new { border-bottom: 1px blue solid; }
63:
64: h2 { page-break-before: always; }
65: h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
66: h1 + h2, hr + h2.no-toc { page-break-before: auto; }
67:
68: p > span:not([title=""]):not([class="XXX"]):not([class="impl"]), li > span:not([title=""]):not([class="XXX"]):not([class="impl"]) { border-bottom: solid #9999CC; }
69:
70: div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
71: div.head p { margin: 0; }
72: div.head h1 { margin: 0; }
73: div.head .logo { float: right; margin: 0 1em; }
74: div.head .logo img { border: none } /* remove border from top image */
75: div.head dl { margin: 1em 0; }
76: div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
77:
78: body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
79: body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
80: body > .toc > li > * { margin-bottom: 0.5em; }
81: body > .toc > li > * > li > * { margin-bottom: 0.25em; }
82: .toc, .toc li { list-style: none; }
83:
84: .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
85: .brief li { margin: 0; padding: 0; }
86: .brief li p { margin: 0; padding: 0; }
87:
88: .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
89: .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
90: .category-list li { display: inline; }
91: .category-list li:not(:last-child)::after { content: ', '; }
92: .category-list li > span, .category-list li > a { text-transform: lowercase; }
93: .category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
94:
95: .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
96: .XXX > :first-child { margin-top: 0; }
97: p .XXX { line-height: 3em; }
98: .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
99: .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
100: .annotation :link, .annotation :visited { color: inherit; }
101: .annotation :link:hover, .annotation :visited:hover { background: transparent; }
102: .annotation span { border: none ! important; }
103: .note { color: green; background: transparent; font-family: sans-serif; }
104: .warning { color: red; background: transparent; }
105: .note, .warning { font-weight: bolder; font-style: italic; }
106: p.note, div.note { padding: 0.5em 2em; }
107: span.note { padding: 0 2em; }
108: .note p:first-child, .warning p:first-child { margin-top: 0; }
109: .note p:last-child, .warning p:last-child { margin-bottom: 0; }
110: .warning:before { font-style: normal; }
111: p.note:before { content: 'Note: '; }
112: p.warning:before { content: '\26A0 Warning! '; }
113:
114: .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
115: .bookkeeping { font-size: 0.8em; margin: 2em 0; }
116: .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
117:
118: h4 { position: relative; z-index: 3; }
119: h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
120: .element {
121: background: #EEEEFF;
122: color: black;
123: margin: 0 0 1em 0.15em;
124: padding: 0 1em 0.25em 0.75em;
125: border-left: solid #9999FF 0.25em;
126: position: relative;
127: z-index: 1;
128: }
129: .element:before {
130: position: absolute;
131: z-index: 2;
132: top: 0;
133: left: -1.15em;
134: height: 2em;
135: width: 0.9em;
136: background: #EEEEFF;
137: content: ' ';
138: border-style: none none solid solid;
139: border-color: #9999FF;
140: border-width: 0.25em;
141: }
142:
143: .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
144: td > .example:only-child { margin: 0 0 0 0.1em; }
145:
146: ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
147: ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
148: ul.domTree li li { list-style: none; }
149: 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; }
150: 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; }
151: ul.domTree span { font-style: italic; font-family: serif; }
152: ul.domTree .t1 code { color: purple; font-weight: bold; }
153: ul.domTree .t2 { font-style: normal; font-family: monospace; }
154: ul.domTree .t2 .name { color: black; font-weight: bold; }
155: ul.domTree .t2 .value { color: blue; font-weight: normal; }
156: ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
157: ul.domTree .t7 code, .domTree .t8 code { color: green; }
158: ul.domTree .t10 code { color: teal; }
159:
160: body.dfnEnabled dfn { cursor: pointer; }
161: .dfnPanel {
162: display: inline;
163: position: absolute;
164: z-index: 10;
165: height: auto;
166: width: auto;
167: padding: 0.5em 0.75em;
168: font: small sans-serif, Droid Sans Fallback;
169: background: #DDDDDD;
170: color: black;
171: border: outset 0.2em;
172: }
173: .dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
174: .dfnPanel :link, .dfnPanel :visited { color: black; }
175: .dfnPanel p { font-weight: bolder; }
176: .dfnPanel * + p { margin-top: 0.25em; }
177: .dfnPanel li { list-style-position: inside; }
178:
179: #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
180: #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
181: #configUI p label { display: block; }
182: #configUI #updateUI, #configUI .loginUI { text-align: center; }
183: #configUI input[type=button] { display: block; margin: auto; }
184: </style><style type="text/css">
185:
186: .applies thead th > * { display: block; }
187: .applies thead code { display: block; }
188: .applies tbody th { whitespace: nowrap; }
189: .applies td { text-align: center; }
190: .applies .yes { background: yellow; }
191:
192: .matrix, .matrix td { border: none; text-align: right; }
193: .matrix { margin-left: 2em; }
194:
195: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
196: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
197: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
198:
199: #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
200: #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
201: #table-example-1 caption { padding-bottom: 0.5em; }
202: #table-example-1 thead, #table-example-1 tbody { border: none; }
203: #table-example-1 th, #table-example-1 td { border: solid thin; }
204: #table-example-1 th { font-weight: normal; }
205: #table-example-1 td { border-style: none solid; vertical-align: top; }
206: #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
207: #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
208: #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
209: #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
210: #table-example-1 tbody td:first-child::after { content: leader(". "); }
211: #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
212: #table-example-1 tbody td:first-child + td { width: 10em; }
213: #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
214: #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
215:
216: .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
217: .apple-table-examples * { font-family: "Times", serif; }
218: .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
219: .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
220: .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
221: .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
222: .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
223: .apple-table-examples td { text-align: right; vertical-align: top; }
224: .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
225: .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
226: .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
227: .apple-table-examples sup { line-height: 0; }
228:
229: .details-example img { vertical-align: top; }
230:
231: #named-character-references-table {
232: font-size: 0.6em;
233: column-width: 28em;
234: column-gap: 1em;
235: -moz-column-width: 28em;
236: -moz-column-gap: 1em;
237: -webkit-column-width: 28em;
238: -webkit-column-gap: 1em;
239: }
240: #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
241: #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; }
242:
1.2 mike 243: .glyph.control { color: red; }
244:
1.4 mike 245: @font-face {
246: font-family: 'Essays1743';
247: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
248: }
249: @font-face {
250: font-family: 'Essays1743';
251: font-weight: bold;
252: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
253: }
254: @font-face {
255: font-family: 'Essays1743';
256: font-style: italic;
257: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
258: }
259: @font-face {
260: font-family: 'Essays1743';
261: font-style: italic;
262: font-weight: bold;
263: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
264: }
265:
1.1 mike 266: </style><style type="text/css">
267: .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; }
268: </style><link href="data:text/css," id="complete" rel="stylesheet" title="Complete specification"><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"><script type="text/javascript">
269: function getCookie(name) {
270: var params = location.search.substr(1).split("&");
271: for (var index = 0; index < params.length; index++) {
272: if (params[index] == name)
273: return "1";
274: var data = params[index].split("=");
275: if (data[0] == name)
276: return unescape(data[1]);
277: }
278: var cookies = document.cookie.split("; ");
279: for (var index = 0; index < cookies.length; index++) {
280: var data = cookies[index].split("=");
281: if (data[0] == name)
282: return unescape(data[1]);
283: }
284: return null;
285: }
286: function load(script) {
287: var e = document.createElement('script');
288: e.setAttribute('src', 'http://www.whatwg.org/specs/web-apps/current-work/' + script + '?' + encodeURIComponent(location) + '&' + encodeURIComponent(document.referrer));
289: document.body.appendChild(e);
290: }
291: function init() {
292: if (location.search == '?slow-browser')
293: return;
294: var configUI = document.createElement('div');
295: configUI.id = 'configUI';
296: document.body.appendChild(configUI);
297: // load('reviewer.js'); // would need cross-site XHR
298: if (document.getElementById('head'))
299: load('toc.js');
300: load('styler.js');
301: // load('updater.js'); // would need cross-site XHR
302: load('dfn.js'); // doesn't support split-out specs, but, oh well.
303: // load('status.js'); // would need cross-site XHR
304: if (getCookie('profile') == '1')
305: document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
306: fixBrokenLink();
307: }
1.5 ! mike 308: </script><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text/css">
1.1 mike 309: <script src="link-fixup.js"></script>
310: <link href="scripting-1.html" title="4.3 Scripting" rel="prev">
311: <link href="spec.html#contents" title="Table of contents" rel="index">
312: <link href="grouping-content.html" title="4.5 Grouping content" rel="next">
313: </head><body onload="fixBrokenLink(); init()"><div class="head" id="head">
314: <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
1.3 mike 315:
1.1 mike 316: <h1>HTML5</h1>
317: </div><div>
318: <a href="scripting-1.html">← 4.3 Scripting</a> –
319: <a href="spec.html#contents">Table of contents</a> –
320: <a href="grouping-content.html">4.5 Grouping content →</a>
321: <ol class="toc"><li><ol><li><a href="sections.html#sections"><span class="secno">4.4 </span>Sections</a>
322: <ol><li><a href="sections.html#the-body-element-0"><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>,
323: <code>h3</code>, <code>h4</code>,
324: <code>h5</code>, and <code>h6</code>
325: 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>
326: <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>
327:
328: <h3 id="sections"><span class="secno">4.4 </span>Sections</h3><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><h4 id="the-body-element-0"><span class="secno">4.4.1 </span>The <dfn><code>body</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
329: <dd><a href="#sectioning-root">Sectioning root</a>.</dd>
330: <dt>Contexts in which this element may be used:</dt>
331: <dd>As the second element in an <code><a href="semantics.html#the-html-element-0">html</a></code> element.</dd>
332: <dt>Content model:</dt>
333: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
334: <dt>Content attributes:</dt>
335: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
336: <dd><code title="handler-window-onafterprint"><a href="webappapis.html#handler-window-onafterprint">onafterprint</a></code></dd>
337: <dd><code title="handler-window-onbeforeprint"><a href="webappapis.html#handler-window-onbeforeprint">onbeforeprint</a></code></dd>
338: <dd><code title="handler-window-onbeforeunload"><a href="webappapis.html#handler-window-onbeforeunload">onbeforeunload</a></code></dd>
339: <dd><code title="handler-window-onblur"><a href="webappapis.html#handler-window-onblur">onblur</a></code></dd>
340: <dd><code title="handler-window-onerror"><a href="webappapis.html#handler-window-onerror">onerror</a></code></dd>
341: <dd><code title="handler-window-onfocus"><a href="webappapis.html#handler-window-onfocus">onfocus</a></code></dd>
342: <dd><code title="handler-window-onhashchange"><a href="webappapis.html#handler-window-onhashchange">onhashchange</a></code></dd>
343: <dd><code title="handler-window-onload"><a href="webappapis.html#handler-window-onload">onload</a></code></dd>
344: <dd><code title="handler-window-onmessage"><a href="webappapis.html#handler-window-onmessage">onmessage</a></code></dd>
345: <dd><code title="handler-window-onoffline"><a href="webappapis.html#handler-window-onoffline">onoffline</a></code></dd>
346: <dd><code title="handler-window-ononline"><a href="webappapis.html#handler-window-ononline">ononline</a></code></dd>
347: <dd><code title="handler-window-onpagehide"><a href="webappapis.html#handler-window-onpagehide">onpagehide</a></code></dd>
348: <dd><code title="handler-window-onpageshow"><a href="webappapis.html#handler-window-onpageshow">onpageshow</a></code></dd>
349: <dd><code title="handler-window-onpopstate"><a href="webappapis.html#handler-window-onpopstate">onpopstate</a></code></dd>
350: <dd><code title="handler-window-onredo"><a href="webappapis.html#handler-window-onredo">onredo</a></code></dd>
351: <dd><code title="handler-window-onresize"><a href="webappapis.html#handler-window-onresize">onresize</a></code></dd>
352: <dd><code title="handler-window-onstorage"><a href="webappapis.html#handler-window-onstorage">onstorage</a></code></dd>
353: <dd><code title="handler-window-onundo"><a href="webappapis.html#handler-window-onundo">onundo</a></code></dd>
354: <dd><code title="handler-window-onunload"><a href="webappapis.html#handler-window-onunload">onunload</a></code></dd>
355: <dt>DOM interface:</dt>
356: <dd>
357: <pre class="idl">interface <dfn id="htmlbodyelement">HTMLBodyElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
358: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onafterprint" title="handler-window-onafterprint">onafterprint</a>;
359: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onbeforeprint" title="handler-window-onbeforeprint">onbeforeprint</a>;
360: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onbeforeunload" title="handler-window-onbeforeunload">onbeforeunload</a>;
361: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onblur" title="handler-window-onblur">onblur</a>;
362: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onerror" title="handler-window-onerror">onerror</a>;
363: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onfocus" title="handler-window-onfocus">onfocus</a>;
364: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onhashchange" title="handler-window-onhashchange">onhashchange</a>;
365: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onload" title="handler-window-onload">onload</a>;
366: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onmessage" title="handler-window-onmessage">onmessage</a>;
367: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onoffline" title="handler-window-onoffline">onoffline</a>;
368: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-ononline" title="handler-window-ononline">ononline</a>;
369: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onpopstate" title="handler-window-onpopstate">onpopstate</a>;
370: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onpagehide" title="handler-window-onpagehide">onpagehide</a>;
371: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onpageshow" title="handler-window-onpageshow">onpageshow</a>;
372: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onredo" title="handler-window-onredo">onredo</a>;
373: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onresize" title="handler-window-onresize">onresize</a>;
374: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onstorage" title="handler-window-onstorage">onstorage</a>;
375: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onundo" title="handler-window-onundo">onundo</a>;
376: attribute <a href="webappapis.html#function">Function</a> <a href="webappapis.html#handler-window-onunload" title="handler-window-onunload">onunload</a>;
377: };</pre>
378: </dd>
379: </dl><p>The <code><a href="#the-body-element-0">body</a></code> element <a href="rendering.html#represents">represents</a> the main
380: content of the document.</p><p>In conforming documents, there is only one <code><a href="#the-body-element-0">body</a></code>
381: element. The <code title="dom-document-body"><a href="dom.html#dom-document-body">document.body</a></code>
382: IDL attribute provides scripts with easy access to a document's
383: <code><a href="#the-body-element-0">body</a></code> element.</p><div class="impl">
384:
385: <p class="note">Some DOM operations (for example, parts of the
386: <a href="dnd.html#dnd">drag and drop</a> model) are defined in terms of "<a href="dom.html#the-body-element">the
387: body element</a>". This refers to a particular element in the
388: DOM, as per the definition of the term, and not any arbitrary
389: <code><a href="#the-body-element-0">body</a></code> element.</p>
390:
391: </div><p>The <code><a href="#the-body-element-0">body</a></code> element exposes as <a href="webappapis.html#event-handler-content-attributes">event handler
392: content attributes</a> a number of the <a href="webappapis.html#event-handlers">event
393: handlers</a> of the <code><a href="browsers.html#window">Window</a></code> object. It also mirrors
394: 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>, and <code title="handler-window-onload"><a href="webappapis.html#handler-window-onload">onload</a></code> <a href="webappapis.html#event-handlers">event
395: handlers</a> of the <code><a href="browsers.html#window">Window</a></code> object, exposed on the
396: <code><a href="#the-body-element-0">body</a></code> element, shadow the generic <a href="webappapis.html#event-handlers">event
397: handlers</a> with the same names normally supported by <a href="infrastructure.html#html-elements">HTML
398: 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">the
399: body element</a> of a <code><a href="infrastructure.html#document">Document</a></code> would first trigger
400: the <code title="handler-onerror"><a href="webappapis.html#handler-onerror">onerror</a></code> <a href="webappapis.html#event-handler-content-attributes">event handler
401: content attributes</a> of that element, then that of the root
402: <code><a href="semantics.html#the-html-element-0">html</a></code> element, and only <em>then</em> would it trigger
403: 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
404: attribute</a> on the <code><a href="#the-body-element-0">body</a></code> element. This is because
405: the event would bubble from the target, to the <code><a href="#the-body-element-0">body</a></code>, to
406: the <code><a href="semantics.html#the-html-element-0">html</a></code>, to the <code><a href="infrastructure.html#document">Document</a></code>, to the
407: <code><a href="browsers.html#window">Window</a></code>, and the <a href="webappapis.html#event-handlers" title="event handlers">event
408: handler</a> on the <code><a href="#the-body-element-0">body</a></code> is watching the
409: <code><a href="browsers.html#window">Window</a></code> not the <code><a href="#the-body-element-0">body</a></code>. A regular event
410: listener attached to the <code><a href="#the-body-element-0">body</a></code> using <code title="">addEventListener()</code>, however, would fire when the
411: event bubbled through the <code><a href="#the-body-element-0">body</a></code> and not when it reaches
412: the <code><a href="browsers.html#window">Window</a></code> object.</p><div class="example">
413:
414: <p>This page updates an indicator to show whether or not the user
415: is online:</p>
416:
417: <pre><!DOCTYPE HTML>
418: <html>
419: <head>
420: <title>Online or offline?</title>
421: <script>
422: function update(online) {
423: document.getElementById('status').textContent =
424: online ? 'Online' : 'Offline';
425: }
426: </script>
427: </head>
428: <body ononline="update(true)"
429: onoffline="update(false)"
430: onload="update(navigator.onLine)">
431: <p>You are: <span id="status">(Unknown)</span></p>
432: </body>
433: </html></pre>
434:
435: </div><h4 id="the-section-element"><span class="secno">4.4.2 </span>The <dfn><code>section</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
436: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
437: <dd><a href="content-models.html#sectioning-content">Sectioning content</a>.</dd>
438: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
439: <dt>Contexts in which this element may be used:</dt>
440: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
441: <dt>Content model:</dt>
442: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
443: <dt>Content attributes:</dt>
444: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
445: <dt>DOM interface:</dt>
446: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
447: </dl><p>The <code><a href="#the-section-element">section</a></code> element <a href="rendering.html#represents">represents</a> a
448: generic section of a document or application. A section, in this
449: context, is a thematic grouping of content, typically with a
450: heading.</p><p class="example">Examples of sections would be chapters, the
451: various tabbed pages in a tabbed dialog box, or the numbered
452: sections of a thesis. A Web site's home page could be split into
453: sections for an introduction, news items, contact information.</p><p class="note">Authors are encouraged to use the
454: <code><a href="#the-article-element">article</a></code> element instead of the <code><a href="#the-section-element">section</a></code>
455: element when it would make sense to syndicate the contents of the
456: element.</p><p class="note" id="use-div-for-wrappers">The <code><a href="#the-section-element">section</a></code>
457: element is not a generic container element. When an element is
458: needed for styling purposes or as a convenience for scripting,
459: authors are encouraged to use the <code><a href="grouping-content.html#the-div-element">div</a></code> element
460: instead. A general rule is that the <code><a href="#the-section-element">section</a></code> element is
461: appropriate only if the element's contents would be listed
462: explicitly in the document's <a href="#outline">outline</a>.</p><div class="example">
463:
464: <p>In the following example, we see an article (part of a larger
465: Web page) about apples, containing two short sections.</p>
466:
467: <pre><article>
468: <hgroup>
469: <h1>Apples</h1>
470: <h2>Tasty, delicious fruit!</h2>
471: </hgroup>
472: <p>The apple is the pomaceous fruit of the apple tree.</p>
473: <section>
474: <h1>Red Delicious</h1>
475: <p>These bright red apples are the most common found in many
476: supermarkets.</p>
477: </section>
478: <section>
479: <h1>Granny Smith</h1>
480: <p>These juicy, green apples make a great filling for
481: apple pies.</p>
482: </section>
483: </article></pre>
484:
485: <p>Notice how the use of <code><a href="#the-section-element">section</a></code> means that the author
486: can use <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code> elements throughout, without having to
487: worry about whether a particular section is at the top level, the
488: second level, the third level, and so on.</p>
489:
490: </div><div class="example">
491:
492: <p>Here is a graduation programme with two sections, one for the
493: list of people graduating, and one for the description of the
494: ceremony.</p>
495:
496: <pre><!DOCTYPE Html>
497: <Html
498: ><Head
499: ><Title
500: >Graduation Ceremony Summer 2022</Title
501: ></Head
502: ><Body
503: ><H1
504: >Graduation</H1
505: ><Section
506: ><H1
507: >Ceremony</H1
508: ><P
509: >Opening Procession</P
510: ><P
511: >Speech by Validactorian</P
512: ><P
513: >Speech by Class President</P
514: ><P
515: >Presentation of Diplomas</P
516: ><P
517: >Closing Speech by Headmaster</P
518: ></Section
519: ><Section
520: ><H1
521: >Graduates</H1
522: ><Ul
523: ><Li
524: >Molly Carpenter</Li
525: ><Li
526: >Anastasia Luccio</Li
527: ><Li
528: >Ebenezar McCoy</Li
529: ><Li
530: >Karrin Murphy</Li
531: ><Li
532: >Thomas Raith</Li
533: ><Li
534: >Susan Rodriguez</Li
535: ></Ul
536: ></Section
537: ></Body
538: ></Html></pre>
539:
540: </div><h4 id="the-nav-element"><span class="secno">4.4.3 </span>The <dfn><code>nav</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
541: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
542: <dd><a href="content-models.html#sectioning-content">Sectioning content</a>.</dd>
543: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
544: <dt>Contexts in which this element may be used:</dt>
545: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
546: <dt>Content model:</dt>
547: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
548: <dt>Content attributes:</dt>
549: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
550: <dt>DOM interface:</dt>
551: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
552: </dl><p>The <code><a href="#the-nav-element">nav</a></code> element <a href="rendering.html#represents">represents</a> a section of
553: a page that links to other pages or to parts within the page: a
554: section with navigation links.</p><p>Not all groups of links on a page need to be in a
555: <code><a href="#the-nav-element">nav</a></code> element — only sections that consist of major
556: navigation blocks are appropriate for the <code><a href="#the-nav-element">nav</a></code>
557: element. In particular, it is common for footers to have a short
558: list of links to various pages of a site, such as the terms of
559: service, the home page, and a copyright page. The
560: <code><a href="#the-footer-element">footer</a></code> element alone is sufficient for such cases,
561: without a <code><a href="#the-nav-element">nav</a></code> element.</p><p class="note">User agents (such as screen readers) that are
562: targeted at users who can benefit from navigation information being
563: omitted in the initial rendering, or who can benefit from navigation
564: information being immediately available, can use this element as a
565: way to determine what content on the page to initially skip and/or
566: provide on request.</p><div class="example">
567:
568: <p>In the following example, the page has several places where
569: links are present, but only one of those places is considered a
570: navigation section.</p>
571:
572: <pre><body>
573: <header>
574: <h1>Wake up sheeple!</h1>
575: <p><a href="news.html">News</a> -
576: <a href="blog.html">Blog</a> -
577: <a href="forums.html">Forums</a></p>
578: <p>Last Modified: <time>2009-04-01</time></p>
579: <nav>
580: <h1>Navigation</h1>
581: <ul>
582: <li><a href="articles.html">Index of all articles</a></li>
583: <li><a href="today.html">Things sheeple need to wake up for today</a></li>
584: <li><a href="successes.html">Sheeple we have managed to wake</a></li>
585: </ul>
586: </nav>
587: </header>
588: <div>
589: <article>
590: <header>
591: <h1>My Day at the Beach</h1>
592: </header>
593: <div>
594: <p>Today I went to the beach and had a lot of fun.</p>
595: <em>...more content...</em>
596: </div>
597: <footer>
598: <p>Posted <time pubdate datetime="2009-10-10T14:36-08:00">Thursday</time>.</p>
599: </footer>
600: </article>
601: <em>...more blog posts...</em>
602: </div>
603: <footer>
604: <p>Copyright © 2006 The Example Company</p>
605: <p><a href="about.html">About</a> -
606: <a href="policy.html">Privacy Policy</a> -
607: <a href="contact.html">Contact Us</a></p>
608: </footer>
609: </body></pre>
610:
611: <p>Notice the <code><a href="grouping-content.html#the-div-element">div</a></code> elements being used to wrap all the
612: contents of the page other than the header and footer, and all the
613: contents of the blog entry other than its header and footer.</p>
614:
615: </div><div class="example">
616:
617: <p>In the following example, there are two <code><a href="#the-nav-element">nav</a></code>
618: elements, one for primary navigation around the site, and one for
619: secondary navigation around the page itself.</p>
620:
621: <pre><body>
622: <h1>The Wiki Center Of Exampland</h1>
623: <nav>
624: <ul>
625: <li><a href="/">Home</a></li>
626: <li><a href="/events">Current Events</a></li>
627: <em>...more...</em>
628: </ul>
629: </nav>
630: <article>
631: <header>
632: <h1>Demos in Exampland</h1>
633: <p>Written by A. N. Other.</p>
634: </header>
635: <nav>
636: <ul>
637: <li><a href="#public">Public demonstrations</a></li>
638: <li><a href="#destroy">Demolitions</a></li>
639: <em>...more...</em>
640: </ul>
641: </nav>
642: <div>
643: <section id="public">
644: <h1>Public demonstrations</h1>
645: <p><em>...more...</em></p>
646: </section>
647: <section id="destroy">
648: <h1>Demolitions</h1>
649: <p><em>...more...</em></p>
650: </section>
651: <em>...more...</em>
652: </div>
653: <footer>
654: <p><a href="?edit">Edit</a> | <a href="?delete">Delete</a> | <a href="?Rename">Rename</a></p>
655: </footer>
656: </article>
657: <footer>
658: <p><small>© copyright 1998 Exampland Emperor</small></p>
659: </footer>
660: </body></pre>
661:
662: </div><h4 id="the-article-element"><span class="secno">4.4.4 </span>The <dfn><code>article</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
663: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
664: <dd><a href="content-models.html#sectioning-content">Sectioning content</a>.</dd>
665: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
666: <dt>Contexts in which this element may be used:</dt>
667: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
668: <dt>Content model:</dt>
669: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
670: <dt>Content attributes:</dt>
671: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
672: <dt>DOM interface:</dt>
673: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
674: </dl><p>The <code><a href="#the-article-element">article</a></code> element <a href="rendering.html#represents">represents</a> a
675: self-contained composition in a document, page, application, or site
676: and that is intended to be independently distributable or reusable,
677: e.g. in syndication. This could be a forum post, a magazine or
678: newspaper article, a blog entry, a user-submitted comment, an
679: interactive widget or gadget, or any other independent item of
680: content.</p><p>When <code><a href="#the-article-element">article</a></code> elements are nested, the inner
681: <code><a href="#the-article-element">article</a></code> elements represent articles that are in
682: principle related to the contents of the outer article. For
683: instance, a blog entry on a site that accepts user-submitted
684: comments could represent the comments as <code><a href="#the-article-element">article</a></code>
685: elements nested within the <code><a href="#the-article-element">article</a></code> element for the blog
686: entry.</p><p>Author information associated with an <code><a href="#the-article-element">article</a></code>
687: element (q.v. the <code><a href="#the-address-element">address</a></code> element) does not apply to
688: nested <code><a href="#the-article-element">article</a></code> elements.</p><p class="note">When used specifically with content to be
689: redistributed in syndication, the <code><a href="#the-article-element">article</a></code> element is
690: similar in purpose to the <code title="">entry</code> element in
691: Atom. <a href="references.html#refsATOM">[ATOM]</a>
692:
693: </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
694: provide the publication date for an <code><a href="#the-article-element">article</a></code>
695: element.</p><div class="example" id="article-example">
696:
697: <p>This example shows a blog post using the <code><a href="#the-article-element">article</a></code>
698: element:</p>
699:
700: <pre><article>
701: <header>
702: <h1>The Very First Rule of Life</h1>
703: <p><time pubdate datetime="2009-10-09T14:28-08:00"></time></p>
704: </header>
705: <p>If there's a microphone anywhere near you, assume it's hot and
706: sending whatever you're saying to the world. Seriously.</p>
707: <p><em>...</em></p>
708: <footer>
709: <a href="?comments=1">Show comments...</a>
710: </footer>
711: </article></pre>
712:
713: <p>Here is that same blog post, but showing some of the comments:</p>
714:
715: <pre><article>
716: <header>
717: <h1>The Very First Rule of Life</h1>
718: <p><time pubdate datetime="2009-10-09T14:28-08:00"></time></p>
719: </header>
720: <p>If there's a microphone anywhere near you, assume it's hot and
721: sending whatever you're saying to the world. Seriously.</p>
722: <p><em>...</em></p>
723: <section>
724: <h1>Comments</h1>
725: <article>
726: <footer>
727: <p>Posted by: George Washington</p>
728: <p><time pubdate datetime="2009-10-10T19:10-08:00"></time></p>
729: </footer>
730: <p>Yeah! Especially when talking about your lobbyist friends!</p>
731: </article>
732: <article>
733: <footer>
734: <p>Posted by: George Hammond</p>
735: <p><time pubdate datetime="2009-10-10T19:15-08:00"></time></p>
736: </footer>
737: <p>Hey, you have the same first name as me.</p>
738: </article>
739: </section>
740: </article></pre>
741:
742: <p>Notice the use of <code><a href="#the-footer-element">footer</a></code> to give the information
743: each comment (such as who wrote it and when): the
744: <code><a href="#the-footer-element">footer</a></code> element <em>can</em> appear at the start of its
745: section when appropriate, such as in this case. (Using
746: <code><a href="#the-header-element">header</a></code> in this case wouldn't be wrong either; it's
747: mostly a matter of authoring preference.)</p>
748:
1.4 mike 749: </div><h4 id="the-aside-element"><span class="secno">4.4.5 </span>The <dfn><code>aside</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1.1 mike 750: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
751: <dd><a href="content-models.html#sectioning-content">Sectioning content</a>.</dd>
752: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
753: <dt>Contexts in which this element may be used:</dt>
754: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
755: <dt>Content model:</dt>
756: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
757: <dt>Content attributes:</dt>
758: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
759: <dt>DOM interface:</dt>
760: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
761: </dl><p>The <code><a href="#the-aside-element">aside</a></code> element <a href="rendering.html#represents">represents</a> a section
762: of a page that consists of content that is tangentially related to
763: the content around the <code><a href="#the-aside-element">aside</a></code> element, and which could
764: be considered separate from that content. Such sections are often
765: represented as sidebars in printed typography.</p><p>The element can be used for typographical effects like pull
766: quotes or sidebars, for advertising, for groups of <code><a href="#the-nav-element">nav</a></code>
767: elements, and for other content that is considered separate from the
768: 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>
769: element just for parentheticals, since those are part of the main
770: flow of the document.</p><div class="example">
771:
772: <p>The following example shows how an aside is used to mark up
773: background material on Switzerland in a much longer news story on
774: Europe.</p>
775:
776: <pre><aside>
777: <h1>Switzerland</h1>
778: <p>Switzerland, a land-locked country in the middle of geographic
779: Europe, has not joined the geopolitical European Union, though it is
780: a signatory to a number of European treaties.</p>
781: </aside></pre>
782:
783: </div><div class="example">
784:
785: <p>The following example shows how an aside is used to mark up
786: a pull quote in a longer article.</p>
787:
788: <pre>...
789:
790: <p>He later joined a large company, continuing on the same work.
791: <q>I love my job. People ask me what I do for fun when I'm not at
792: work. But I'm paid to do my hobby, so I never know what to
793: answer. Some people wonder what they would do if they didn't have to
794: work... but I know what I would do, because I was unemployed for a
795: year, and I filled that time doing exactly what I do now.</q></p>
796:
797: <aside>
798: <q> People ask me what I do for fun when I'm not at work. But I'm
799: paid to do my hobby, so I never know what to answer. </q>
800: </aside>
801:
802: <p>Of course his work — or should that be hobby? —
803: isn't his only passion. He also enjoys other pleasures.</p>
804:
805: ...</pre>
806:
807: </div><div class="example">
808:
809: <p>The following extract shows how <code><a href="#the-aside-element">aside</a></code> can be used
810: for blogrolls and other side content on a blog:</p>
811:
812: <pre><body>
813: <header>
814: <h1>My wonderful blog</h1>
815: <p>My tagline</p>
816: </header>
817: <aside>
818: <!-- <em>this aside contains two sections that are tangentially related
819: to the page, namely, links to other blogs, and links to blog posts
820: from this blog</em> -->
821: <nav>
822: <h1>My blogroll</h1>
823: <ul>
824: <li><a href="http://blog.example.com/">Example Blog</a>
825: </ul>
826: </nav>
827: <nav>
828: <h1>Archives</h1>
829: <ol reversed>
830: <li><a href="/last-post">My last post</a>
831: <li><a href="/first-post">My first post</a>
832: </ol>
833: </nav>
834: </aside>
835: <aside>
836: <!-- <em>this aside is tangentially related to the page also, it
837: contains twitter messages from the blog author</em> -->
838: <h1>Twitter Feed</h1>
839: <blockquote cite="http://twitter.example.net/t31351234">
840: I'm on vacation, writing my blog.
841: </blockquote>
842: <blockquote cite="http://twitter.example.net/t31219752">
843: I'm going to go on vacation soon.
844: </blockquote>
845: </aside>
846: <article>
847: <!-- <em>this is a blog post</em> -->
848: <h1>My last post</h1>
849: <p>This is my last post.</p>
850: <footer>
851: <p><a href="/last-post" rel=bookmark>Permalink</a>
852: </footer>
853: </article>
854: <article>
855: <!-- <em>this is also a blog post</em> -->
856: <h1>My first post</h1>
857: <p>This is my first post.</p>
858: <aside>
859: <!-- <em>this aside is about the blog post, since it's inside the
860: <article> element; it would be wrong, for instance, to put the
861: blogroll here, since the blogroll isn't really related to this post
862: specifically, only to the page as a whole</em> -->
863: <h1>Posting</h1>
864: <p>While I'm thinking about it, I wanted to say something about
865: posting. Posting is fun!</p>
866: </aside>
867: <footer>
868: <p><a href="/first-post" rel=bookmark>Permalink</a>
869: </footer>
870: </article>
871: <footer>
872: <nav>
873: <a href="/archives">Archives</a> —
874: <a href="/about">About me</a> —
875: <a href="/copyright">Copyright</a>
876: </nav>
877: </footer>
878: </body></pre>
879:
880: </div><h4 id="the-h1-h2-h3-h4-h5-and-h6-elements"><span class="secno">4.4.6 </span>The <dfn><code>h1</code></dfn>, <dfn><code>h2</code></dfn>,
881: <dfn><code>h3</code></dfn>, <dfn><code>h4</code></dfn>,
882: <dfn><code>h5</code></dfn>, and <dfn><code>h6</code></dfn>
883: elements</h4><dl class="element"><dt>Categories</dt>
884: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
885: <dd><a href="content-models.html#heading-content">Heading content</a>.</dd>
886: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
887: <dt>Contexts in which this element may be used:</dt>
888: <dd>As a child of an <code><a href="#the-hgroup-element">hgroup</a></code> element.</dd>
889: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
890: <dt>Content model:</dt>
891: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
892: <dt>Content attributes:</dt>
893: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
894: <dt>DOM interface:</dt>
895: <dd>
896: <pre class="idl">interface <dfn id="htmlheadingelement">HTMLHeadingElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {};</pre>
897: </dd>
898: </dl><p>These elements <a href="rendering.html#represents" title="represents">represent</a> headings
899: for their sections.</p><p>The semantics and meaning of these elements are defined in the
900: 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
901: 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
902: rank, the <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> element has the lowest rank, and two
903: elements with the same name have equal rank.</p><div class="example">
904:
905: <p>These two snippets are equivalent:</p>
906:
907: <pre><body>
908: <h1>Let's call it a draw(ing surface)</h1>
909: <h2>Diving in</h2>
910: <h2>Simple shapes</h2>
911: <h2>Canvas coordinates</h2>
912: <h3>Canvas coordinates diagram</h3>
913: <h2>Paths</h2>
914: </body></pre>
915:
916: <pre><body>
917: <h1>Let's call it a draw(ing surface)</h1>
918: <section>
919: <h1>Diving in</h1>
920: </section>
921: <section>
922: <h1>Simple shapes</h1>
923: </section>
924: <section>
925: <h1>Canvas coordinates</h1>
926: <section>
927: <h1>Canvas coordinates diagram</h1>
928: </section>
929: </section>
930: <section>
931: <h1>Paths</h1>
932: </section>
933: </body></pre>
934:
935: </div><h4 id="the-hgroup-element"><span class="secno">4.4.7 </span>The <dfn><code>hgroup</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
936: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
937: <dd><a href="content-models.html#heading-content">Heading content</a>.</dd>
938: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
939: <dt>Contexts in which this element may be used:</dt>
940: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
941: <dt>Content model:</dt>
942: <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>
943: <dt>Content attributes:</dt>
944: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
945: <dt>DOM interface:</dt>
946: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
947: </dl><p>The <code><a href="#the-hgroup-element">hgroup</a></code> element <a href="rendering.html#represents">represents</a> the
948: heading of a section. The element is used to group a set of
949: <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
950: multiple levels, such as subheadings, alternative titles, or
951: taglines.</p><p>For the purposes of document summaries, outlines, and the like,
952: the text of <code><a href="#the-hgroup-element">hgroup</a></code> elements is defined to be the text
953: of the highest <a href="#rank" title="rank">ranked</a>
954: <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
955: <code><a href="#the-hgroup-element">hgroup</a></code> element, if there are any such elements, and the
956: first such element if there are multiple elements with that
957: <a href="#rank">rank</a>. If there are no such elements, then the text of
958: 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
959: <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
960: 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>
961: element descendant of the <code><a href="#the-hgroup-element">hgroup</a></code> element, if there are
962: 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>
963: element (the highest rank).</p><p>The section on <a href="#headings-and-sections">headings and sections</a>
964: defines how <code><a href="#the-hgroup-element">hgroup</a></code> elements are assigned to individual
965: sections.</p><div class="example">
966:
967: <p>Here are some examples of valid headings. In each case, the
968: emphasized text represents the text that would be used as the
969: heading in an application extracting heading data and ignoring
970: subheadings.</p>
971:
972: <pre><hgroup>
973: <h1><strong>The reality dysfunction</strong></h1>
974: <h2>Space is not the only void</h2>
975: </hgroup></pre>
976:
977: <pre><hgroup>
978: <h1><strong>Dr. Strangelove</strong></h1>
979: <h2>Or: How I Learned to Stop Worrying and Love the Bomb</h2>
980: </hgroup></pre>
981:
982: <p>The point of using <code><a href="#the-hgroup-element">hgroup</a></code> in these examples is to
983: mask the <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code> element (which acts as a secondary title)
984: from the <a href="#outline">outline</a> algorithm.</p><!--
985: http://www.brucelawson.co.uk/2009/html-5-is-a-mess/#comment-618895
986: -->
987:
988: </div><h4 id="the-header-element"><span class="secno">4.4.8 </span>The <dfn><code>header</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
989: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
990: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
991: <dt>Contexts in which this element may be used:</dt>
992: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
993: <dt>Content model:</dt>
994: <dd><a href="content-models.html#flow-content">Flow content</a>, but with no <code><a href="#the-header-element">header</a></code> or
995: <code><a href="#the-footer-element">footer</a></code> element descendants.</dd>
996: <dt>Content attributes:</dt>
997: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
998: <dt>DOM interface:</dt>
999: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
1000: </dl><p>The <code><a href="#the-header-element">header</a></code> element <a href="rendering.html#represents">represents</a> a group
1001: of introductory or navigational aids.</p><p class="note">A <code><a href="#the-header-element">header</a></code> element is intended to usually
1002: contain the section's heading (an
1003: <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
1004: <code><a href="#the-hgroup-element">hgroup</a></code> element), but this is not required. The
1005: <code><a href="#the-header-element">header</a></code> element can also be used to wrap a section's
1006: table of contents, a search form, or any relevant logos.</p><div class="example">
1007:
1008: <p>Here are some sample headers. This first one is for a game:</p>
1009:
1010: <pre><header>
1011: <p>Welcome to...</p>
1012: <h1>Voidwars!</h1>
1013: </header></pre>
1014:
1015: <p>The following snippet shows how the element can be used to mark
1016: up a specification's header:</p>
1017:
1018: <pre><header>
1019: <hgroup>
1020: <h1>Scalable Vector Graphics (SVG) 1.2</h1>
1021: <h2>W3C Working Draft 27 October 2004</h2>
1022: </hgroup>
1023: <dl>
1024: <dt>This version:</dt>
1025: <dd><a href="http://www.w3.org/TR/2004/WD-SVG12-20041027/">http://www.w3.org/TR/2004/WD-SVG12-20041027/</a></dd>
1026: <dt>Previous version:</dt>
1027: <dd><a href="http://www.w3.org/TR/2004/WD-SVG12-20040510/">http://www.w3.org/TR/2004/WD-SVG12-20040510/</a></dd>
1028: <dt>Latest version of SVG 1.2:</dt>
1029: <dd><a href="http://www.w3.org/TR/SVG12/">http://www.w3.org/TR/SVG12/</a></dd>
1030: <dt>Latest SVG Recommendation:</dt>
1031: <dd><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></dd>
1032: <dt>Editor:</dt>
1033: <dd>Dean Jackson, W3C, <a href="mailto:dean@w3.org">dean@w3.org</a></dd>
1034: <dt>Authors:</dt>
1035: <dd>See <a href="#authors">Author List</a></dd>
1036: </dl>
1037: <p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notic <em>...</em>
1038: </header></pre>
1039:
1040: </div><p class="note">The <code><a href="#the-header-element">header</a></code> element is not
1041: <a href="content-models.html#sectioning-content">sectioning content</a>; it doesn't introduce a new
1042: section.</p><div class="example">
1043:
1044: <p>In this example, the page has a page heading given by the
1045: <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code> element, and two subsections whose headings are
1046: given by <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code> elements. The content after the
1047: <code><a href="#the-header-element">header</a></code> element is still part of the last subsection
1048: started in the <code><a href="#the-header-element">header</a></code> element, because the
1049: <code><a href="#the-header-element">header</a></code> element doesn't take part in the
1050: <a href="#outline">outline</a> algorithm.</p>
1051:
1052: <pre><body>
1053: <header>
1054: <h1>Little Green Guys With Guns</h1>
1055: <nav>
1056: <ul>
1057: <li><a href="/games">Games</a>
1058: <li><a href="/forum">Forum</a>
1059: <li><a href="/download">Download</a>
1060: </ul>
1061: </nav>
1062: <h2>Important News</h2> <!-- this starts a second subsection -->
1063: <!-- this is part of the subsection entitled "Important News" -->
1064: <p>To play today's games you will need to update your client.</p>
1065: <h2>Games</h2> <!-- this starts a third subsection -->
1066: </header>
1067: <p>You have three active games:</p>
1068: <!-- this is still part of the subsection entitled "Games" -->
1069: ...</pre>
1070:
1071: </div><h4 id="the-footer-element"><span class="secno">4.4.9 </span>The <dfn><code>footer</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1072: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
1073: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
1074: <dt>Contexts in which this element may be used:</dt>
1075: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
1076: <dt>Content model:</dt>
1077: <dd><a href="content-models.html#flow-content">Flow content</a>, but with no <code><a href="#the-header-element">header</a></code> or
1078: <code><a href="#the-footer-element">footer</a></code> element descendants.</dd>
1079: <dt>Content attributes:</dt>
1080: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
1081: <dt>DOM interface:</dt>
1082: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
1083: </dl><p>The <code><a href="#the-footer-element">footer</a></code> element <a href="rendering.html#represents">represents</a> a footer
1084: for its nearest ancestor <a href="content-models.html#sectioning-content">sectioning content</a> or
1085: <a href="#sectioning-root">sectioning root</a> element. A footer typically contains
1086: information about its section such as who wrote it, links to related
1087: documents, copyright data, and the like.</p><p class="note">Contact information for the author or editor of a
1088: section belongs in an <code><a href="#the-address-element">address</a></code> element, possibly itself
1089: 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
1090: section, though they usually do.</p><p>When the <code><a href="#the-footer-element">footer</a></code> element contains entire sections,
1091: they <a href="rendering.html#represents" title="represents">represent</a> appendices, indexes,
1092: long colophons, verbose license agreements, and other such
1093: content.</p><p class="note">The <code><a href="#the-footer-element">footer</a></code> element is not
1094: <a href="content-models.html#sectioning-content">sectioning content</a>; it doesn't introduce a new
1095: section.</p><p>When the nearest ancestor <a href="content-models.html#sectioning-content">sectioning content</a> or
1096: <a href="#sectioning-root">sectioning root</a> element is <a href="dom.html#the-body-element">the body
1097: element</a>, then it applies to the whole page.</p><div class="example">
1098:
1099: <p>Here is a page with two footers, one at the top and one at the
1100: bottom, with the same content:</p>
1101:
1102: <pre><body>
1103: <footer><a href="../">Back to index...</a></footer>
1104: <hgroup>
1105: <h1>Lorem ipsum</h1>
1106: <h2>The ipsum of all lorems</h2>
1107: </hgroup>
1108: <p>A dolor sit amet, consectetur adipisicing elit, sed do eiusmod
1109: tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
1110: veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
1111: ea commodo consequat. Duis aute irure dolor in reprehenderit in
1112: voluptate velit esse cillum dolore eu fugiat nulla
1113: pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
1114: culpa qui officia deserunt mollit anim id est laborum.</p>
1115: <footer><a href="../">Back to index...</a></footer>
1116: </body></pre>
1117:
1118: </div><div class="example">
1119:
1120: <p>Here is an example which shows the <code><a href="#the-footer-element">footer</a></code> element
1121: being used both for a site-wide footer and for a section
1122: footer.</p>
1123:
1124: <pre><!DOCTYPE HTML>
1125: <HTML><HEAD>
1126: <TITLE>The Ramblings of a Scientist</TITLE>
1127: <BODY>
1128: <H1>The Ramblings of a Scientist</H1>
1129: <ARTICLE>
1130: <H1>Episode 15</H1>
1131: <VIDEO SRC="/fm/015.ogv" CONTROLS PRELOAD>
1132: <P><A HREF="/fm/015.ogv">Download video</A>.</P>
1133: </VIDEO>
1134: <FOOTER> <!-- footer for article -->
1135: <P>Published <TIME PUBDATE DATETIME="2009-10-21T18:26-07:00"></TIME></P>
1136: </FOOTER>
1137: </ARTICLE>
1138: <ARTICLE>
1139: <H1>My Favorite Trains</H1>
1140: <P>I love my trains. My favorite train of all time is a Köf.</P>
1141: <P>It is fun to see them pull some coal cars because they look so
1142: dwarfed in comparison.</P>
1143: <FOOTER> <!-- footer for article -->
1144: <P>Published <TIME PUBDATE DATETIME="2009-09-15T14:54-07:00"></TIME></P>
1145: </FOOTER>
1146: </ARTICLE>
1147: <FOOTER> <!-- site wide footer -->
1148: <NAV>
1149: <P><A HREF="/credits.html">Credits</A> —
1150: <A HREF="/tos.html">Terms of Service</A> —
1151: <A HREF="/index.html">Blog Index</A></P>
1152: </NAV>
1153: <P>Copyright © 2009 Gordon Freeman</P>
1154: </FOOTER>
1155: </BODY>
1156: </HTML></pre>
1157:
1158: </div><h4 id="the-address-element"><span class="secno">4.4.10 </span>The <dfn><code>address</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1159: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
1160: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
1161: <dt>Contexts in which this element may be used:</dt>
1162: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
1163: <dt>Content model:</dt>
1164: <dd><a href="content-models.html#flow-content">Flow content</a>, but with no <a href="content-models.html#heading-content">heading
1165: content</a> descendants, no <a href="content-models.html#sectioning-content">sectioning content</a>
1166: descendants, and no <code><a href="#the-header-element">header</a></code>, <code><a href="#the-footer-element">footer</a></code>, or
1167: <code><a href="#the-address-element">address</a></code> element descendants.</dd>
1168: <dt>Content attributes:</dt>
1169: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
1170: <dt>DOM interface:</dt>
1171: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
1172: </dl><p>The <code><a href="#the-address-element">address</a></code> element <a href="rendering.html#represents">represents</a> the
1173: contact information for its nearest <code><a href="#the-article-element">article</a></code> or
1174: <code><a href="#the-body-element-0">body</a></code> element ancestor. If that is <a href="dom.html#the-body-element">the body
1175: element</a>, then the contact information applies to the document
1176: as a whole.</p><div class="example">
1177: <p>For example, a page at the W3C Web site related to HTML might
1178: include the following contact information:</p>
1179: <pre><ADDRESS>
1180: <A href="../People/Raggett/">Dave Raggett</A>,
1181: <A href="../People/Arnaud/">Arnaud Le Hors</A>,
1182: contact persons for the <A href="Activity">W3C HTML Activity</A>
1183: </ADDRESS></pre>
1184: </div><p>The <code><a href="#the-address-element">address</a></code> element must not be used to represent
1185: arbitrary addresses (e.g. postal addresses), unless those addresses
1186: are in fact the relevant contact information. (The <code><a href="grouping-content.html#the-p-element">p</a></code>
1187: element is the appropriate element for marking up postal addresses
1188: in general.)</p><p>The <code><a href="#the-address-element">address</a></code> element must not contain information
1189: other than contact information.</p><div class="example">
1190: <p>For example, the following is non-conforming use of the
1191: <code><a href="#the-address-element">address</a></code> element:</p>
1192: <pre class="bad"><ADDRESS>Last Modified: 1999/12/24 23:37:50</ADDRESS></pre>
1193: </div><p>Typically, the <code><a href="#the-address-element">address</a></code> element would be included
1194: along with other information in a <code><a href="#the-footer-element">footer</a></code> element.</p><div class="impl">
1195:
1196: <p>The contact information for a node <var title="">node</var> is a
1197: collection of <code><a href="#the-address-element">address</a></code> elements defined by the first
1198: applicable entry from the following list:</p>
1199:
1200: <dl class="switch"><dt>If <var title="">node</var> is an <code><a href="#the-article-element">article</a></code> element</dt>
1201: <dt>If <var title="">node</var> is a <code><a href="#the-body-element-0">body</a></code> element</dt>
1202:
1203: <dd>
1204:
1205: <p>The contact information consists of all the
1206: <code><a href="#the-address-element">address</a></code> elements that have <var title="">node</var>
1207: as an ancestor and do not have another <code><a href="#the-body-element-0">body</a></code> or
1208: <code><a href="#the-article-element">article</a></code> element ancestor that is a descendant of <var title="">node</var>.</p>
1209:
1210: </dd>
1211:
1212: <dt>If <var title="">node</var> has an ancestor element that is an <code><a href="#the-article-element">article</a></code> element</dt>
1213: <dt>If <var title="">node</var> has an ancestor element that is a <code><a href="#the-body-element-0">body</a></code> element</dt>
1214:
1215: <dd>
1216:
1217: <p>The contact information of <var title="">node</var> is the same
1218: as the contact information of the nearest <code><a href="#the-article-element">article</a></code> or
1219: <code><a href="#the-body-element-0">body</a></code> element ancestor, whichever is nearest.</p>
1220:
1221: </dd>
1222:
1223: <dt>If <var title="">node</var>'s <code><a href="infrastructure.html#document">Document</a></code> has <a href="dom.html#the-body-element" title="the body element">a body element</a></dt>
1224:
1225: <dd>
1226:
1227: <p>The contact information of <var title="">node</var> is the same
1228: as the contact information <a href="dom.html#the-body-element">the body element</a> of the
1229: <code><a href="infrastructure.html#document">Document</a></code>.</p>
1230:
1231: </dd>
1232:
1233: <dt>Otherwise</dt>
1234:
1235: <dd>
1236:
1237: <p>There is no contact information for <var title="">node</var>.</p>
1238:
1239: </dd>
1240:
1241: </dl><p>User agents may expose the contact information of a node to the
1242: user, or use it for other purposes, such as indexing sections based
1243: on the sections' contact information.</p>
1244:
1245: </div><h4 id="headings-and-sections"><span class="secno">4.4.11 </span><dfn>Headings and sections</dfn></h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><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
1246: <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
1247: of <a href="content-models.html#sectioning-content">sectioning content</a> <a href="rendering.html#represents">represents</a> the
1248: heading for that section. Subsequent headings of equal or higher
1249: <a href="#rank">rank</a> start new (implied) sections, headings of lower
1250: <a href="#rank">rank</a> start implied subsections that are part of the
1251: previous one. In both cases, the element <a href="rendering.html#represents">represents</a> the
1252: heading of the implied section.</p><p>Certain elements are said to be <dfn id="sectioning-root" title="sectioning
1253: root">sectioning roots</dfn>, including <code><a href="grouping-content.html#the-blockquote-element">blockquote</a></code> and
1254: <code><a href="tabular-data.html#the-td-element">td</a></code> elements. These elements can have their own
1255: outlines, but the sections and headings inside these elements do not
1256: contribute to the outlines of their ancestors.</p><!-- when updating this also update the category index --><ul class="brief category-list"><li><code><a href="grouping-content.html#the-blockquote-element">blockquote</a></code></li>
1257: <li><code><a href="#the-body-element-0">body</a></code></li>
1258: <!-- v2DATAGRID <li><code>datagrid</code></li> -->
1259: <li><code><a href="interactive-elements.html#the-details-element">details</a></code></li>
1260: <li><code><a href="forms.html#the-fieldset-element">fieldset</a></code></li>
1261: <li><code><a href="grouping-content.html#the-figure-element">figure</a></code></li>
1262: <li><code><a href="tabular-data.html#the-td-element">td</a></code></li>
1263: </ul><!-- a root element isn't a sectioning root. This means, for
1264: instance, that you don't get an outline if you just have a random
1265: XML file with <html:h1> elements in it. Other vocabs need to define
1266: what their sectioning root is. --><p><a href="content-models.html#sectioning-content">Sectioning content</a> elements are always considered
1267: subsections of their nearest ancestor <a href="#sectioning-root">sectioning root</a>
1268: or their nearest ancestor element of <a href="content-models.html#sectioning-content">sectioning
1269: content</a>, whichever is nearest, regardless of what implied
1270: sections other headings may have created.</p><div class="example">
1271: <p>For the following fragment:</p>
1272: <pre><body>
1273: <h1>Foo</h1>
1274: <h2>Bar</h2>
1275: <blockquote>
1276: <h3>Bla</h3>
1277: </blockquote>
1278: <p>Baz</p>
1279: <h2>Quux</h2>
1280: <section>
1281: <h3>Thud</h3>
1282: </section>
1283: <p>Grunt</p>
1284: </body></pre>
1285: <p>...the structure would be:</p>
1286: <ol><li>
1287: Foo (heading of explicit <code><a href="#the-body-element-0">body</a></code> section, containing the "Grunt" paragraph)
1288: <ol><li>
1289: Bar (heading starting implied section, containing a block quote and the "Baz" paragraph)
1290: </li>
1291: <li>
1292: Quux (heading starting implied section with no content other than the heading itself)
1293: </li>
1294: <li>
1295: Thud (heading of explicit <code><a href="#the-section-element">section</a></code> section)
1296: </li>
1297: </ol></li>
1298: </ol><p>Notice how the <code><a href="#the-section-element">section</a></code> ends the earlier implicit
1299: section so that a later paragraph ("Grunt") is back at the top
1300: level.</p>
1301: </div><p>Sections may contain headings of any <a href="#rank">rank</a>, but
1302: authors are strongly encouraged to either use only <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>
1303: elements, or to use elements of the appropriate <a href="#rank">rank</a>
1304: for the section's nesting level.</p><p>Authors are also encouraged to explicitly wrap sections in
1305: elements of <a href="content-models.html#sectioning-content">sectioning content</a>, instead of relying on
1306: the implicit sections generated by having multiple headings in one
1307: element of <a href="content-models.html#sectioning-content">sectioning content</a>.</p><div class="example">
1308: <p>For example, the following is correct:</p>
1309:
1310: <pre><body>
1311: <h4>Apples</h4>
1312: <p>Apples are fruit.</p>
1313: <section>
1314: <h2>Taste</h2>
1315: <p>They taste lovely.</p>
1316: <h6>Sweet</h6>
1317: <p>Red apples are sweeter than green ones.</p>
1318: <h1>Color</h1>
1319: <p>Apples come in various colors.</p>
1320: </section>
1321: </body></pre>
1322:
1323: <p>However, the same document would be more clearly expressed
1324: as:</p>
1325:
1326: <pre><body>
1327: <h1>Apples</h1>
1328: <p>Apples are fruit.</p>
1329: <section>
1330: <h2>Taste</h2>
1331: <p>They taste lovely.</p>
1332: <section>
1333: <h3>Sweet</h3>
1334: <p>Red apples are sweeter than green ones.</p>
1335: </section>
1336: </section>
1337: <section>
1338: <h2>Color</h2>
1339: <p>Apples come in various colors.</p>
1340: </section>
1341: </body></pre>
1342:
1343: <p>Both of the documents above are semantically identical and would
1344: produce the same outline in compliant user agents.</p>
1345:
1346: </div><h5 id="outlines"><span class="secno">4.4.11.1 </span>Creating an outline</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><div class="impl">
1347:
1348: <!-- v2 idea: It would be nice if there was a way to use this to
1349: autogenerate a table of contents or some such -->
1350:
1351: <p>This section defines an algorithm for creating an outline for a
1352: <a href="content-models.html#sectioning-content">sectioning content</a> element or a <a href="#sectioning-root">sectioning
1353: root</a> element. It is defined in terms of a walk over the nodes
1354: of a DOM tree, in tree order, with each node being visited when it
1355: is <i>entered</i> and when it is <i>exited</i> during the walk.</p>
1356:
1357: </div><p>The <dfn id="outline">outline</dfn> for a <a href="content-models.html#sectioning-content">sectioning content</a>
1358: element or a <a href="#sectioning-root">sectioning root</a> element consists of a list
1359: 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
1360: corresponds to some nodes in the original DOM tree. Each section can
1361: have one heading associated with it, and can contain any number of
1362: further nested sections. <span class="impl">The algorithm for the
1363: outline also associates each node in the DOM tree with a particular
1364: section and potentially a heading.</span> (The sections in the
1365: outline aren't <code><a href="#the-section-element">section</a></code> elements, though some may
1366: correspond to such elements — they are merely conceptual
1367: sections.)</p><div class="example">
1368:
1369: <p>The following markup fragment:</p>
1370:
1371: <pre><body>
1372: <h1>A</h1>
1373: <p>B</p>
1374: <h2>C</h2>
1375: <p>D</p>
1376: <h2>E</h2>
1377: <p>F</p>
1378: </body></pre>
1379:
1380: <p>...results in the following outline being created for the
1381: <code><a href="#the-body-element-0">body</a></code> node (and thus the entire document):</p>
1382:
1383: <ol class="brief"><li>
1384: <p>Section created for <code><a href="#the-body-element-0">body</a></code> node.</p>
1385: <p>Associated with heading "A".</p>
1386: <p>Also associated with paragraph "B".</p>
1387: <p>Nested sections:</p>
1388: <ol class="brief"><li>
1389: <p>Section implied for first <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code> element.</p>
1390: <p>Associated with heading "C".</p>
1391: <p>Also associated with paragraph "D".</p>
1392: <p>No nested sections.</p>
1393: </li>
1394: <li>
1395: <p>Section implied for second <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code> element.</p>
1396: <p>Associated with heading "E".</p>
1397: <p>Also associated with paragraph "F".</p>
1398: <p>No nested sections.</p>
1399: </li>
1400: </ol></li>
1401: </ol></div><div class="impl">
1402:
1403: <p>The algorithm that must be followed during a walk of a DOM
1404: subtree rooted at a <a href="content-models.html#sectioning-content">sectioning content</a> element or a
1405: <a href="#sectioning-root">sectioning root</a> element to determine that element's
1406: <a href="#outline">outline</a> is as follows:</p>
1407:
1408: <ol><li><p>Let <var title="">current outlinee</var> be null. (It holds
1409: the element whose <a href="#outline">outline</a> is being created.)</p></li>
1410:
1411: <li><p>Let <var title="">current section</var> be null. (It holds a
1412: pointer to a <a href="#concept-section" title="concept-section">section</a>, so that
1413: elements in the DOM can all be associated with a section.)</p></li>
1414:
1415: <li><p>Create a stack to hold elements, which is used to handle
1416: nesting. Initialize this stack to empty.</p></li>
1417:
1418: <li>
1419:
1420: <p>As you walk over the DOM in <a href="infrastructure.html#tree-order">tree order</a>, trigger
1421: the first relevant step below for each element as you enter and
1422: exit it.</p>
1423:
1424: <dl class="switch"><dt>If the top of the stack is an element, and you are exiting
1425: that element</dt>
1426:
1427: <dd>
1428:
1429: <p class="note">The element being exited is a <a href="content-models.html#heading-content">heading
1430: content</a> element.</p>
1431:
1432: <p>Pop that element from the stack.</p>
1433:
1434: </dd>
1435:
1436:
1437: <dt>If the top of the stack is a <a href="content-models.html#heading-content">heading content</a>
1438: element</dt>
1439:
1440: <dd><p>Do nothing.</p></dd>
1441:
1442:
1443: <dt>When entering a <a href="content-models.html#sectioning-content">sectioning content</a> element or a
1444: <a href="#sectioning-root">sectioning root</a> element</dt>
1445:
1446: <dd>
1447:
1448: <p>If <var title="">current outlinee</var> is not null, and the
1449: <var title="">current section</var> has no heading, create an
1450: implied heading and let that be the heading for the <var title="">current section</var>.</p>
1451:
1452: <p>If <var title="">current outlinee</var> is not null, push
1453: <var title="">current outlinee</var> onto the stack.</p>
1454:
1455: <p>Let <var title="">current outlinee</var> be the element
1456: that is being entered.</p>
1457:
1458: <p>Let <var title="">current section</var> be a newly created
1459: <a href="#concept-section" title="concept-section">section</a> for the <var title="">current outlinee</var> element.</p>
1460:
1461: <p>Let there be a new <a href="#outline">outline</a> for the new <var title="">current outlinee</var>, initialized with just the new
1462: <var title="">current section</var> as the only <a href="#concept-section" title="concept-section">section</a> in the outline.</p>
1463:
1464: </dd>
1465:
1466:
1467: <dt>When exiting a <a href="content-models.html#sectioning-content">sectioning content</a> element, if
1468: the stack is not empty</dt>
1469:
1470: <dd>
1471:
1472: <p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</p>
1473:
1474: <p>Let <var title="">current section</var> be the last section
1475: in the <a href="#outline">outline</a> of the <var title="">current
1476: outlinee</var> element.</p>
1477:
1478: <p>Append the <a href="#outline">outline</a> of the <a href="content-models.html#sectioning-content">sectioning
1479: content</a> element being exited to the <var title="">current
1480: section</var>. (This does not change which section is the last
1481: section in the <a href="#outline">outline</a>.)</p>
1482:
1483: </dd>
1484:
1485:
1486: <dt>When exiting a <a href="#sectioning-root">sectioning root</a> element, if the
1487: stack is not empty</dt>
1488:
1489: <dd>
1490:
1491: <p>Run these steps:</p>
1492:
1493: <ol><li><p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</p></li>
1494:
1495: <li><p>Let <var title="">current section</var> be the last
1496: section in the <a href="#outline">outline</a> of the <var title="">current
1497: outlinee</var> element.</p></li>
1498:
1499: <li><p><i>Finding the deepest child</i>: If <var title="">current section</var> has no child sections, stop
1500: these steps.</p></li>
1501:
1502: <li><p>Let <var title="">current section</var> be the last
1503: child <a href="#concept-section" title="concept-section">section</a> of the
1504: current <var title="">current section</var>.</p></li>
1505:
1506: <li><p>Go back to the substep labeled <i>finding the deepest
1507: child</i>.</p></li>
1508:
1509: </ol></dd>
1510:
1511:
1512: <dt>When exiting a <a href="content-models.html#sectioning-content">sectioning content</a> element or a
1513: <a href="#sectioning-root">sectioning root</a> element</dt>
1514:
1515: <dd>
1516:
1517: <p class="note">The <var title="">current outlinee</var> is
1518: the element being exited.</p>
1519:
1520: <p>Let <var title="">current section</var> be the first <a href="#concept-section" title="concept-section">section</a> in the
1521: <a href="#outline">outline</a> of the <var title="">current outlinee</var>
1522: element.</p>
1523:
1524: <p>Skip to the next step in the overall set of steps. (The walk
1525: is over.)</p>
1526:
1527: </dd>
1528:
1529:
1530: <dt>If the <var title="">current outlinee</var> is null</dt>
1531:
1532: <dd><p>Do nothing.</p></dd>
1533:
1534:
1535: <dt>When entering a <a href="content-models.html#heading-content">heading content</a> element</dt>
1536:
1537: <dd>
1538:
1539: <p>If the <var title="">current section</var> has no heading,
1540: let the element being entered be the heading for the <var title="">current section</var>.</p>
1541:
1542: <p>Otherwise, if the element being entered has a
1543: <a href="#rank">rank</a> equal to or greater than the heading of the
1544: 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
1545: <a href="#outline">outline</a> of the <var title="">current outlinee</var>
1546: element, so that this new section is the new last section of
1547: that outline. Let <var title="">current section</var> be that
1548: new section. Let the element being entered be the new heading
1549: for the <var title="">current section</var>.</p>
1550:
1551: <p>Otherwise, run these substeps:</p>
1552:
1553: <ol><li><p>Let <var title="">candidate section</var> be <var title="">current section</var>.</p></li>
1554:
1555: <li><p>If the element being entered has a <a href="#rank">rank</a>
1556: 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
1557: section is the last section in the outline.) Let <var title="">current section</var> be this new section. Let the
1558: element being entered be the new heading for the <var title="">current section</var>. Abort these substeps.</p>
1559:
1560: </li><li><p>Let <var title="">new candidate section</var> be the
1561: <a href="#concept-section" title="concept-section">section</a> that contains <var title="">candidate section</var> in the <a href="#outline">outline</a> of
1562: <var title="">current outlinee</var>.</p></li>
1563:
1564: <li><p>Let <var title="">candidate section</var> be <var title="">new candidate section</var>.</p></li>
1565:
1566: <li><p>Return to step 2.</p></li>
1567:
1568: </ol><p>Push the element being entered onto the stack. (This causes
1569: the algorithm to skip any descendants of the element.)</p>
1570:
1571: <p class="note">Recall that <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code> has the
1572: <em>highest</em> rank, and <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> has the lowest
1573: rank.</p>
1574:
1575: </dd>
1576:
1577:
1578: <dt>Otherwise</dt>
1579:
1580: <dd><p>Do nothing.</p></dd>
1581:
1582: </dl><p id="associatedSection">In addition, whenever you exit a node,
1583: after doing the steps above, if <var title="">current
1584: section</var> is not null, associate the node with the <a href="#concept-section" title="concept-section">section</a> <var title="">current
1585: section</var>.</p>
1586:
1587: </li>
1588:
1589: <li><p>If the <var title="">current outlinee</var> is null,
1590: then there was no <a href="content-models.html#sectioning-content">sectioning content</a> element or
1591: <a href="#sectioning-root">sectioning root</a> element in the DOM. There is no
1592: <a href="#outline">outline</a>. Abort these steps.</p></li>
1593:
1594: <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>
1595:
1596: <li><p>Associate all nodes with the heading of the <a href="#concept-section" title="concept-section">section</a> with which they are
1597: associated, if any.</p></li>
1598:
1599: <li><p>If <var title="">current outlinee</var> is <a href="dom.html#the-body-element">the body
1600: element</a>, then the outline created for that element is the
1601: <a href="#outline">outline</a> of the entire document.</p></li>
1602:
1603: </ol><p>The tree of sections created by the algorithm above, or a proper
1604: subset thereof, must be used when generating document outlines, for
1605: example when generating tables of contents.</p>
1606:
1607: <p>When creating an interactive table of contents, entries should
1608: jump the user to the relevant <a href="content-models.html#sectioning-content">sectioning content</a>
1609: element, if the <a href="#concept-section" title="concept-section">section</a> was
1610: created for a real element in the original document, or to the
1611: 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
1612: a heading in the above process.</p>
1613:
1614: <p class="note">Selecting the first <a href="#concept-section" title="concept-section">section</a> of the document therefore
1615: always takes the user to the top of the document, regardless of
1616: where the first heading in the <code><a href="#the-body-element-0">body</a></code> is to be found.</p>
1617:
1618: <p>The <dfn id="outline-depth">outline depth</dfn> of a <a href="content-models.html#heading-content">heading content</a>
1619: element associated with a <a href="#concept-section" title="concept-section">section</a> <var title="">section</var>
1620: is the number of <a href="#concept-section" title="concept-section">sections</a> that
1621: are ancestors of <var title="">section</var> in the
1622: <a href="#outline">outline</a> that <var title="">section</var> finds itself
1623: in when the <a href="#outline" title="outline">outlines</a> of its
1624: <code><a href="infrastructure.html#document">Document</a></code>'s elements are created, plus 1. The
1625: <a href="#outline-depth">outline depth</a> of a <a href="content-models.html#heading-content">heading content</a> element
1626: not associated with a <a href="#concept-section" title="concept-section">section</a>
1627: is 1.</p>
1628:
1629: <p>User agents should provide default headings for sections that do
1630: not have explicit section headings.</p>
1631:
1632: <div class="example">
1633:
1634: <p>Consider the following snippet:</p>
1635:
1636: <pre><body>
1637: <nav>
1638: <p><a href="/">Home</a></p>
1639: </nav>
1640: <p>Hello world.</p>
1641: <aside>
1642: <p>My cat is cute.</p>
1643: </aside>
1644: </body></pre>
1645:
1646: <p>Although it contains no headings, this snippet has three
1647: sections: a document (the <code><a href="#the-body-element-0">body</a></code>) with two subsections
1648: (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
1649: present the outline as follows:</p>
1650:
1651: <ol class="brief"><li>Untitled document
1652: <ol><li>Navigation</li>
1653: <li>Sidebar</li>
1654: </ol></li>
1655: </ol><p>These default headings ("Untitled document", "Navigation",
1656: "Sidebar") are not specified by this specification, and might vary
1657: with the user's language, the page's language, the user's
1658: preferences, the user agent implementor's preferences, etc.</p>
1659:
1660: </div>
1661:
1662: <div class="note">
1663:
1664: <p>The following JavaScript function shows how the tree walk could
1665: be implemented. The <var title="">root</var> argument is the root
1666: of the tree to walk, and the <var title="">enter</var> and <var title="">exit</var> arguments are callbacks that are called with
1667: the nodes as they are entered and exited. <a href="references.html#refsECMA262">[ECMA262]</a></p>
1668:
1669: <pre>function (root, enter, exit) {
1670: var node = root;
1671: start: while (node) {
1672: enter(node);
1673: if (node.firstChild) {
1674: node = node.firstChild;
1675: continue start;
1676: }
1677: while (node) {
1678: exit(node);
1679: if (node.nextSibling) {
1680: node = node.nextSibling;
1681: continue start;
1682: }
1683: if (node == root)
1684: node = null;
1685: else
1686: node = node.parentNode;
1687: }
1688: }
1689: }</pre>
1690:
1691: </div>
1692:
1693: </div></body></html>
Webmaster