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