Annotation of html5/spec-author-view/grouping-content.html, revision 1.2
1.1 mike 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
2: <!DOCTYPE html>
1.2 ! mike 3: <!-- when publishing, change bits marked ZZZ --><html lang="en-US-x-Hixie" class="split chapter"><head><title>4.5 Grouping content — HTML5</title><script src="link-fixup.js"></script><link href="whatwg.css" rel="stylesheet"><style type="text/css">
1.1 mike 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 { 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: #EEFFEE; }
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: .tall-and-narrow {
147: font-size: 0.6em;
148: column-width: 25em;
149: column-gap: 1em;
150: -moz-column-width: 25em;
151: -moz-column-gap: 1em;
152: -webkit-column-width: 25em;
153: -webkit-column-gap: 1em;
154: }
155:
156: ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
157: ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
158: ul.domTree li li { list-style: none; }
159: 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; }
160: 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; }
161: ul.domTree span { font-style: italic; font-family: serif; }
162: ul.domTree .t1 code { color: purple; font-weight: bold; }
163: ul.domTree .t2 { font-style: normal; font-family: monospace; }
164: ul.domTree .t2 .name { color: black; font-weight: bold; }
165: ul.domTree .t2 .value { color: blue; font-weight: normal; }
166: ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
167: ul.domTree .t7 code, .domTree .t8 code { color: green; }
168: ul.domTree .t10 code { color: teal; }
169:
170: #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
171: #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
172: #configUI p label { display: block; }
173: #configUI #updateUI, #configUI .loginUI { text-align: center; }
174: #configUI input[type=button] { display: block; margin: auto; }
175: </style><style type="text/css">
176:
177: .applies thead th > * { display: block; }
178: .applies thead code { display: block; }
179: .applies tbody th { whitespace: nowrap; }
180: .applies td { text-align: center; }
181: .applies .yes { background: yellow; }
182:
183: .matrix, .matrix td { border: none; text-align: right; }
184: .matrix { margin-left: 2em; }
185:
186: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
187: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
188: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
189:
190: #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
191: #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
192: #table-example-1 caption { padding-bottom: 0.5em; }
193: #table-example-1 thead, #table-example-1 tbody { border: none; }
194: #table-example-1 th, #table-example-1 td { border: solid thin; }
195: #table-example-1 th { font-weight: normal; }
196: #table-example-1 td { border-style: none solid; vertical-align: top; }
197: #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
198: #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
199: #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
200: #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
201: #table-example-1 tbody td:first-child::after { content: leader(". "); }
202: #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
203: #table-example-1 tbody td:first-child + td { width: 10em; }
204: #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
205: #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
206:
207: .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
208: .apple-table-examples * { font-family: "Times", serif; }
209: .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
210: .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
211: .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
212: .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
213: .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
214: .apple-table-examples td { text-align: right; vertical-align: top; }
215: .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
216: .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
217: .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
218: .apple-table-examples sup { line-height: 0; }
219:
220: </style><link href="data:text/css," rel="stylesheet" title="Complete specification"><link href="data:text/css,.impl%20%7B%20display:%20none;%20%7D" rel="alternate stylesheet" title="Author documentation only"><link href="data:text/css,.impl%20%7B%20background:%20%23FFEEEE;%20%7D" rel="alternate stylesheet" title="Highlight implementation requirements"><link href="data:text/css," id="complete" rel="stylesheet" title="Complete specification"><link href="data:text/css,.impl%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" id="highlight" rel="alternate stylesheet" title="Highlight implementation requirements"><script>
221: function getCookie(name) {
222: var params = location.search.substr(1).split("&");
223: for (var index = 0; index < params.length; index++) {
224: if (params[index] == name)
225: return "1";
226: var data = params[index].split("=");
227: if (data[0] == name)
228: return unescape(data[1]);
229: }
230: var cookies = document.cookie.split("; ");
231: for (var index = 0; index < cookies.length; index++) {
232: var data = cookies[index].split("=");
233: if (data[0] == name)
234: return unescape(data[1]);
235: }
236: return null;
237: }
238: function load(script) {
239: var e = document.createElement('script');
240: e.setAttribute('src', 'http://www.whatwg.org/specs/web-apps/current-work/' + script + '?' + encodeURIComponent(location) + '&' + encodeURIComponent(document.referrer));
241: document.body.appendChild(e);
242: }
243: function init() {
244: if (location.search == '?slow-browser')
245: return;
246: var configUI = document.createElement('div');
247: configUI.id = 'configUI';
248: document.body.appendChild(configUI);
249: // load('reviewer.js'); // would need cross-site XHR
250: if (document.getElementById('head'))
251: load('toc.js');
252: load('styler.js');
253: // load('updater.js'); // would need cross-site XHR
254: load('dfn.js');
255: // load('status.js'); // would need cross-site XHR
256: if (getCookie('profile') == '1')
257: document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
258: fixBrokenLink();
259: }
260: </script><link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet" type="text/css"><link href="sections.html" title="4.4 Sections" rel="prev">
261: <link href="Overview.html#contents" title="Table of contents" rel="index">
262: <link href="text-level-semantics.html" title="4.6 Text-level semantics" rel="next">
263: </head><body onload="fixBrokenLink(); init()"><div class="head" id="head">
264: <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
265: <h1>HTML5</h1>
266: </div><div>
267: <a href="sections.html">← 4.4 Sections</a> –
268: <a href="Overview.html#contents">Table of contents</a> –
269: <a href="text-level-semantics.html">4.6 Text-level semantics →</a>
270: <ol class="toc"><li><ol><li><a href="grouping-content.html#grouping-content"><span class="secno">4.5 </span>Grouping content</a>
271: <ol><li><a href="grouping-content.html#the-p-element"><span class="secno">4.5.1 </span>The <code>p</code> element</a></li><li><a href="grouping-content.html#the-hr-element"><span class="secno">4.5.2 </span>The <code>hr</code> element</a></li><li><a href="grouping-content.html#the-br-element"><span class="secno">4.5.3 </span>The <code>br</code> element</a></li><li><a href="grouping-content.html#the-pre-element"><span class="secno">4.5.4 </span>The <code>pre</code> element</a></li><li><a href="grouping-content.html#the-blockquote-element"><span class="secno">4.5.5 </span>The <code>blockquote</code> element</a></li><li><a href="grouping-content.html#the-ol-element"><span class="secno">4.5.6 </span>The <code>ol</code> element</a></li><li><a href="grouping-content.html#the-ul-element"><span class="secno">4.5.7 </span>The <code>ul</code> element</a></li><li><a href="grouping-content.html#the-li-element"><span class="secno">4.5.8 </span>The <code>li</code> element</a></li><li><a href="grouping-content.html#the-dl-element"><span class="secno">4.5.9 </span>The <code>dl</code> element</a></li><li><a href="grouping-content.html#the-dt-element"><span class="secno">4.5.10 </span>The <code>dt</code> element</a></li><li><a href="grouping-content.html#the-dd-element"><span class="secno">4.5.11 </span>The <code>dd</code> element</a></li><li><a href="grouping-content.html#the-div-element"><span class="secno">4.5.12 </span>The <code>div</code> element</a></li></ol></li></ol></li></ol></div>
272:
273: <h3 id="grouping-content"><span class="secno">4.5 </span>Grouping content</h3><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><h4 id="the-p-element"><span class="secno">4.5.1 </span>The <dfn><code>p</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
274: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
275: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
276: <dt>Contexts in which this element may be used:</dt>
277: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
278: <dt>Content model:</dt>
279: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
280: <dt>Content attributes:</dt>
281: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
282: <dt>DOM interface:</dt>
283: <dd>
284: <pre class="idl">interface <dfn id="htmlparagraphelement">HTMLParagraphElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {};</pre>
285: </dd>
286: </dl><p>The <code><a href="#the-p-element">p</a></code> element <a href="#represents">represents</a> a
287: <a href="content-models.html#paragraph">paragraph</a>.</p><div class="example">
288: <p>The following examples are conforming HTML fragments:</p>
289: <pre><p>The little kitten gently seated himself on a piece of
290: carpet. Later in his life, this would be referred to as the time the
291: cat sat on the mat.</p></pre>
292: <pre><fieldset>
293: <legend>Personal information</legend>
294: <p>
295: <label>Name: <input name="n"></label>
296: <label><input name="anon" type="checkbox"> Hide from other users</label>
297: </p>
298: <p><label>Address: <textarea name="a"></textarea></label></p>
299: </fieldset></pre>
300: <pre><p>There was once an example from Femley,<br>
301: Whose markup was of dubious quality.<br>
302: The validator complained,<br>
303: So the author was pained,<br>
304: To move the error from the markup to the rhyming.</p></pre>
305: </div><p>The <code><a href="#the-p-element">p</a></code> element should not be used when a more
306: specific element is more appropriate.</p><div class="example">
307:
308: <p>The following example is technically correct:</p>
309:
310: <pre><section>
311: <!-- ... -->
312: <p>Last modified: 2001-04-23</p>
313: <p>Author: fred@example.com</p>
314: </section></pre>
315:
316: <p>However, it would be better marked-up as:</p>
317:
318: <pre><section>
319: <!-- ... -->
320: <footer>Last modified: 2001-04-23</footer>
321: <address>Author: fred@example.com</address>
322: </section></pre>
323:
324: <p>Or:</p>
325:
326: <pre><section>
327: <!-- ... -->
328: <footer>
329: <p>Last modified: 2001-04-23</p>
330: <address>Author: fred@example.com</address>
331: </footer>
332: </section></pre>
333:
334: </div><h4 id="the-hr-element"><span class="secno">4.5.2 </span>The <dfn><code>hr</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
335: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
336: <dt>Contexts in which this element may be used:</dt>
337: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
338: <dt>Content model:</dt>
339: <dd>Empty.</dd>
340: <dt>Content attributes:</dt>
341: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
342: <dt>DOM interface:</dt>
343: <dd>
344: <pre class="idl">interface <dfn id="htmlhrelement">HTMLHRElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {};</pre>
345: </dd>
346: </dl><p>The <code><a href="#the-hr-element">hr</a></code> element <a href="#represents">represents</a> a
347: <a href="content-models.html#paragraph">paragraph</a>-level thematic break, e.g. a scene change in
348: a story, or a transition to another topic within a section of a
349: reference book.</p><div class="example">
350:
351: <p>The following extract from <cite>Pandora's Star</cite> by Peter
352: F. Hamilton shows two paragraphs that precede a scene change and
353: the paragraph that follows it. The scene change, represented in the
354: printed book by a gap containing a solitary centered star between
355: the second and third paragraphs, is here represented using the
356: <code><a href="#the-hr-element">hr</a></code> element.</p>
357:
358: <!-- ISBN 1-4050-0020-1; bottom of page 14 -->
359:
360: <pre lang="en-GB"><p>Dudley was ninety-two, in his second life, and fast approaching
361: time for another rejuvenation. Despite his body having the physical
362: age of a standard fifty-year-old, the prospect of a long degrading
363: campaign within academia was one he regarded with dread. For a
364: supposedly advanced civilization, the Intersolar Commonwearth could be
365: appallingly backward at times, not to mention cruel.</p>
366: <p><i>Maybe it won't be that bad</i>, he told himself. The lie was
367: comforting enough to get him through the rest of the night's
368: shift.</p>
369: <strong><hr></strong>
370: <p>The Carlton AllLander drove Dudley home just after dawn. Like the
371: astronomer, the vehicle was old and worn, but perfectly capable of
372: doing its job. It had a cheap diesel engine, common enough on a
373: semi-frontier world like Gralmond, although its drive array was a
374: thoroughly modern photoneural processor. With its high suspension and
375: deep-tread tyres it could plough along the dirt track to the
376: observatory in all weather and seasons, including the metre-deep snow
377: of Gralmond's winters.</p></pre>
378:
379: </div><h4 id="the-br-element"><span class="secno">4.5.3 </span>The <dfn><code>br</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
380: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
381: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
382: <dt>Contexts in which this element may be used:</dt>
383: <dd>Where <a href="content-models.html#phrasing-content">phrasing content</a> is expected.</dd>
384: <dt>Content model:</dt>
385: <dd>Empty.</dd>
386: <dt>Content attributes:</dt>
387: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
388: <dt>DOM interface:</dt>
389: <dd>
390: <pre class="idl">interface <dfn id="htmlbrelement">HTMLBRElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {};</pre>
391: </dd>
392: </dl><p>The <code><a href="#the-br-element">br</a></code> element <a href="#represents">represents</a> a line
393: break.</p><p><code><a href="#the-br-element">br</a></code> elements must be used only for line breaks that
394: are actually part of the content, as in poems or addresses.</p><div class="example">
395:
396: <p>The following example is correct usage of the <code><a href="#the-br-element">br</a></code>
397: element:</p>
398:
399: <pre><p>P. Sherman<br>
400: 42 Wallaby Way<br>
401: Sydney</p></pre>
402:
403: </div><p><code><a href="#the-br-element">br</a></code> elements must not be used for separating thematic
404: groups in a paragraph.</p><div class="example">
405:
406: <p>The following examples are non-conforming, as they abuse the
407: <code><a href="#the-br-element">br</a></code> element:</p>
408:
409: <pre><p><a ...>34 comments.</a><br>
410: <a ...>Add a comment.</a></p></pre>
411:
412: <pre><p><label>Name: <input name="name"></label><br>
413: <label>Address: <input name="address"></label></p></pre>
414:
415: <p>Here are alternatives to the above, which are correct:</p>
416:
417: <pre><p><a ...>34 comments.</a></p>
418: <p><a ...>Add a comment.</a></p></pre>
419:
420: <pre><p><label>Name: <input name="name"></label></p>
421: <p><label>Address: <input name="address"></label></p></pre>
422:
423: </div><p>If a <a href="content-models.html#paragraph">paragraph</a> consists of nothing but a single
424: <code><a href="#the-br-element">br</a></code> element, it represents a placeholder blank line
425: (e.g. as in a template). Such blank lines must not be used for
426: presentation purposes.</p><h4 id="the-pre-element"><span class="secno">4.5.4 </span>The <dfn><code>pre</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
427: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
428: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
429: <dt>Contexts in which this element may be used:</dt>
430: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
431: <dt>Content model:</dt>
432: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
433: <dt>Content attributes:</dt>
434: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
435: <dt>DOM interface:</dt>
436: <dd>
437: <pre class="idl">interface <dfn id="htmlpreelement">HTMLPreElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {};</pre>
438: </dd>
439: </dl><p>The <code><a href="#the-pre-element">pre</a></code> element <a href="#represents">represents</a> a block of
440: preformatted text, in which structure is represented by typographic
441: conventions rather than by elements.</p><p class="note">In <a href="syntax.html#syntax">the HTML syntax</a>, a leading
442: newline character immediately following the <code><a href="#the-pre-element">pre</a></code> element
443: start tag is stripped.</p><p>Some examples of cases where the <code><a href="#the-pre-element">pre</a></code> element could
444: be used:</p><ul><li>Including an e-mail, with paragraphs indicated by blank lines,
445: lists indicated by lines prefixed with a bullet, and so on.</li>
446:
447: <li>Including fragments of computer code, with structure indicated
448: according to the conventions of that language.</li>
449:
450: <li>Displaying ASCII art.</li>
451:
452: </ul><p class="note">Authors are encouraged to consider how preformatted
453: text will be experienced when the formatting is lost, as will be the
454: case for users of speech synthesizers, braille displays, and the
455: like. For cases like ASCII art, it is likely that an alternative
456: presentation, such as a textual description, would be more
457: universally accessible to the readers of the document.</p><p>To represent a block of computer code, the <code><a href="#the-pre-element">pre</a></code>
458: element can be used with a <code><a href="text-level-semantics.html#the-code-element">code</a></code> element; to represent a
459: block of computer output the <code><a href="#the-pre-element">pre</a></code> element can be used
460: with a <code><a href="text-level-semantics.html#the-samp-element">samp</a></code> element. Similarly, the <code><a href="text-level-semantics.html#the-kbd-element">kbd</a></code>
461: element can be used within a <code><a href="#the-pre-element">pre</a></code> element to indicate
462: text that the user is to enter.</p><div class="example">
463:
464: <p>In the following snippet, a sample of computer code is
465: presented.</p>
466:
467: <pre><p>This is the <code>Panel</code> constructor:</p>
468: <pre><code>function Panel(element, canClose, closeHandler) {
469: this.element = element;
470: this.canClose = canClose;
471: this.closeHandler = function () { if (closeHandler) closeHandler() };
472: }</code></pre></pre>
473:
474: </div><div class="example">
475:
476: <p>In the following snippet, <code><a href="text-level-semantics.html#the-samp-element">samp</a></code> and <code><a href="text-level-semantics.html#the-kbd-element">kbd</a></code>
477: elements are mixed in the contents of a <code><a href="#the-pre-element">pre</a></code> element to
478: show a session of Zork I.</p>
479:
480: <pre><pre><samp>You are in an open field west of a big white house with a boarded
481: front door.
482: There is a small mailbox here.
483:
484: ></samp> <kbd>open mailbox</kbd>
485:
486: <samp>Opening the mailbox reveals:
487: A leaflet.
488:
489: ></samp></pre></pre>
490:
491: </div><div class="example">
492:
493: <p>The following shows a contemporary poem that uses the
494: <code><a href="#the-pre-element">pre</a></code> element to preserve its unusual formatting, which
495: forms an intrinsic part of the poem itself.</p>
496:
497: <pre><pre> maxling
498:
499: it is with a heart
500: heavy
501:
502: that i admit loss of a feline
503: so loved
504:
505: a friend lost to the
506: unknown
507: (night)
508:
509: ~cdr 11dec07</pre></pre>
510:
511: </div><h4 id="the-blockquote-element"><span class="secno">4.5.5 </span>The <dfn><code>blockquote</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
512: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
513: <dd><a href="sections.html#sectioning-root">Sectioning root</a>.</dd>
514: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
515: <dt>Contexts in which this element may be used:</dt>
516: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
517: <dt>Content model:</dt>
518: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
519: <dt>Content attributes:</dt>
520: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
521: <dd><code title="attr-blockquote-cite"><a href="#attr-blockquote-cite">cite</a></code></dd>
522: <dt>DOM interface:</dt>
523: <dd>
524: <pre class="idl">interface <dfn id="htmlquoteelement">HTMLQuoteElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
525: attribute DOMString <a href="#dom-quote-cite" title="dom-quote-cite">cite</a>;
526: };</pre>
527: <p class="note">The <code><a href="#htmlquoteelement">HTMLQuoteElement</a></code> interface is
528: also used by the <code><a href="text-level-semantics.html#the-q-element">q</a></code> element.</p>
529: </dd>
530: </dl><p>The <code><a href="#the-blockquote-element">blockquote</a></code> element <a href="#represents">represents</a> a
531: section that is quoted from another source.</p><p>Content inside a <code><a href="#the-blockquote-element">blockquote</a></code> must be quoted from
532: another source, whose address, if it has one, should be cited in the
533: <dfn id="attr-blockquote-cite" title="attr-blockquote-cite"><code>cite</code></dfn>
534: attribute.</p><p>If the <code title="attr-blockquote-cite"><a href="#attr-blockquote-cite">cite</a></code> attribute
535: is present, it must be a <a href="urls.html#valid-url">valid URL</a>. </p><div class="example">
536:
537: <p>This next example shows the use of <code><a href="text-level-semantics.html#the-cite-element">cite</a></code> alongside
538: <code><a href="#the-blockquote-element">blockquote</a></code>:</p>
539:
540: <pre><p>His next piece was the aptly named <cite>Sonnet 130</cite>:</p>
541: <blockquote cite="http://quotes.example.org/s/sonnet130.html">
542: <p>My mistress' eyes are nothing like the sun,<br>
543: Coral is far more red, than her lips red,<br>
544: ...</pre>
545:
546: </div><p class="note"><a href="commands.html#conversations">Examples of how to
547: represent a conversation</a> are shown below; it is not appropriate
548: to use the <code><a href="text-level-semantics.html#the-cite-element">cite</a></code> and <code><a href="#the-blockquote-element">blockquote</a></code> elements
549: for this purpose.</p><h4 id="the-ol-element"><span class="secno">4.5.6 </span>The <dfn><code>ol</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
550: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
551: <dt>Contexts in which this element may be used:</dt>
552: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
553: <dt>Content model:</dt>
554: <dd>Zero or more <code><a href="#the-li-element">li</a></code> elements.</dd>
555: <dt>Content attributes:</dt>
556: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
557: <dd><code title="attr-ol-reversed"><a href="#attr-ol-reversed">reversed</a></code></dd>
558: <dd><code title="attr-ol-start"><a href="#attr-ol-start">start</a></code></dd>
559: <dt>DOM interface:</dt>
560: <dd>
561: <pre class="idl">interface <dfn id="htmlolistelement">HTMLOListElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
562: attribute boolean <a href="#dom-ol-reversed" title="dom-ol-reversed">reversed</a>;
563: attribute long <a href="#dom-ol-start" title="dom-ol-start">start</a>;
564: };</pre>
565: </dd>
566: </dl><p>The <code><a href="#the-ol-element">ol</a></code> element <a href="#represents">represents</a> a list of
567: items, where the items have been intentionally ordered, such that
568: changing the order would change the meaning of the document.</p><p>The items of the list are the <code><a href="#the-li-element">li</a></code> element child nodes
569: of the <code><a href="#the-ol-element">ol</a></code> element, in <a href="infrastructure.html#tree-order">tree order</a>.</p><p>The <dfn id="attr-ol-reversed" title="attr-ol-reversed"><code>reversed</code></dfn>
570: attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a>. If present, it
571: indicates that the list is a descending list (..., 3, 2, 1). If the
572: attribute is omitted, the list is an ascending list (1, 2, 3,
573: ...).</p><p>The <dfn id="attr-ol-start" title="attr-ol-start"><code>start</code></dfn>
574: attribute, if present, must be a <a href="common-microsyntaxes.html#valid-integer">valid integer</a> giving
575: the ordinal value of the first list item.</p><!-- v2: resuming numbering of lists from previous lists? --><div class="example">
576:
577: <p>The following markup shows a list where the order matters, and
578: where the <code><a href="#the-ol-element">ol</a></code> element is therefore appropriate. Compare
579: this list to the equivalent list in the <code><a href="#the-ul-element">ul</a></code> section to
580: see an example of the same items using the <code><a href="#the-ul-element">ul</a></code>
581: element.</p>
582:
583: <pre><p>I have lived in the following countries (given in the order of when
584: I first lived there):</p>
585: <ol>
586: <li>Switzerland
587: <li>United Kingdom
588: <li>United States
589: <li>Norway
590: </ol></pre>
591:
592: <p>Note how changing the order of the list changes the meaning of
593: the document. In the following example, changing the relative order
594: of the first two items has changed the birthplace of the
595: author:</p>
596:
597: <pre><p>I have lived in the following countries (given in the order of when
598: I first lived there):</p>
599: <ol>
600: <li>United Kingdom
601: <li>Switzerland
602: <li>United States
603: <li>Norway
604: </ol></pre>
605:
606: </div><h4 id="the-ul-element"><span class="secno">4.5.7 </span>The <dfn><code>ul</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
607: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
608: <dt>Contexts in which this element may be used:</dt>
609: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
610: <dt>Content model:</dt>
611: <dd>Zero or more <code><a href="#the-li-element">li</a></code> elements.</dd>
612: <dt>Content attributes:</dt>
613: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
614: <dt>DOM interface:</dt>
615: <dd>
616: <pre class="idl">interface <dfn id="htmlulistelement">HTMLUListElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {};</pre>
617: </dd>
618: </dl><p>The <code><a href="#the-ul-element">ul</a></code> element <a href="#represents">represents</a> a list of
619: items, where the order of the items is not important — that
620: is, where changing the order would not materially change the meaning
621: of the document.</p><p>The items of the list are the <code><a href="#the-li-element">li</a></code> element child nodes
622: of the <code><a href="#the-ul-element">ul</a></code> element.</p><div class="example">
623:
624: <p>The following markup shows a list where the order does not
625: matter, and where the <code><a href="#the-ul-element">ul</a></code> element is therefore
626: appropriate. Compare this list to the equivalent list in the
627: <code><a href="#the-ol-element">ol</a></code> section to see an example of the same items using
628: the <code><a href="#the-ol-element">ol</a></code> element.</p>
629:
630: <pre><p>I have lived in the following countries:</p>
631: <ul>
632: <li>Norway
633: <li>Switzerland
634: <li>United Kingdom
635: <li>United States
636: </ul></pre>
637:
638: <p>Note that changing the order of the list does not change the
639: meaning of the document. The items in the snippet above are given
640: in alphabetical order, but in the snippet below they are given in
641: order of the size of their current account balance in 2007, without
642: changing the meaning of the document whatsoever:</p>
643:
644: <pre><p>I have lived in the following countries:</p>
645: <ul>
646: <li>Switzerland
647: <li>Norway
648: <li>United Kingdom
649: <li>United States
650: </ul></pre>
651:
652: </div><h4 id="the-li-element"><span class="secno">4.5.8 </span>The <dfn><code>li</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
653: <dd>None.</dd>
654: <dt>Contexts in which this element may be used:</dt>
655: <dd>Inside <code><a href="#the-ol-element">ol</a></code> elements.</dd>
656: <dd>Inside <code><a href="#the-ul-element">ul</a></code> elements.</dd>
657: <dd>Inside <code><a href="interactive-elements.html#menus">menu</a></code> elements.</dd>
658: <dt>Content model:</dt>
659: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
660: <dt>Content attributes:</dt>
661: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
662: <dd>If the element is a child of an <code><a href="#the-ol-element">ol</a></code> element: <code title="attr-li-value"><a href="#attr-li-value">value</a></code></dd>
663: <dt>DOM interface:</dt>
664: <dd>
665: <pre class="idl">interface <dfn id="htmllielement">HTMLLIElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
666: attribute long <a href="#dom-li-value" title="dom-li-value">value</a>;
667: };</pre>
668: </dd>
669: </dl><p>The <code><a href="#the-li-element">li</a></code> element <a href="#represents">represents</a> a list
670: item. If its parent element is an <code><a href="#the-ol-element">ol</a></code>, <code><a href="#the-ul-element">ul</a></code>,
671: or <code><a href="interactive-elements.html#menus">menu</a></code> element, then the element is an item of the
672: parent element's list, as defined for those elements. Otherwise, the
673: list item has no defined list-related relationship to any other
674: <code><a href="#the-li-element">li</a></code> element.</p><p>The <dfn id="attr-li-value" title="attr-li-value"><code>value</code></dfn>
675: attribute, if present, must be a <a href="common-microsyntaxes.html#valid-integer">valid integer</a> giving
676: the ordinal value of the list item.</p><div class="example">
677: <p>The following example, the top ten movies are listed (in reverse
678: order). Note the way the list is given a title by using a
679: <code><a href="embedded-content-1.html#the-figure-element">figure</a></code> element and its <code><a href="#the-dt-element">dt</a></code> element.</p>
680: <pre><figure>
681: <dt>The top 10 movies of all time</dt>
682: <dd>
683: <ol>
684: <li value="10"><cite>Josie and the Pussycats</cite>, 2001</li>
685: <li value="9"><cite lang="sh">Црна мачка, бели мачор</cite>, 1998</li>
686: <li value="8"><cite>A Bug's Life</cite>, 1998</li>
687: <li value="7"><cite>Toy Story</cite>, 1995</li>
688: <li value="6"><cite>Monsters, Inc</cite>, 2001</li>
689: <li value="5"><cite>Cars</cite>, 2006</li>
690: <li value="4"><cite>Toy Story 2</cite>, 1999</li>
691: <li value="3"><cite>Finding Nemo</cite>, 2003</li>
692: <li value="2"><cite>The Incredibles</cite>, 2004</li>
693: <li value="1"><cite>Ratatouille</cite>, 2007</li>
694: </ol>
695: <dd>
696: </figure></pre>
697:
698: <p>The markup could also be written as follows, using the <code title="attr-ol-reversed"><a href="#attr-ol-reversed">reversed</a></code> attribute on the
699: <code><a href="#the-ol-element">ol</a></code> element:</p>
700:
701: <pre><figure>
702: <dt>The top 10 movies of all time</dt>
703: <dd>
704: <ol reversed>
705: <li><cite>Josie and the Pussycats</cite>, 2001</li>
706: <li><cite lang="sh">Црна мачка, бели мачор</cite>, 1998</li>
707: <li><cite>A Bug's Life</cite>, 1998</li>
708: <li><cite>Toy Story</cite>, 1995</li>
709: <li><cite>Monsters, Inc</cite>, 2001</li>
710: <li><cite>Cars</cite>, 2006</li>
711: <li><cite>Toy Story 2</cite>, 1999</li>
712: <li><cite>Finding Nemo</cite>, 2003</li>
713: <li><cite>The Incredibles</cite>, 2004</li>
714: <li><cite>Ratatouille</cite>, 2007</li>
715: </ol>
716: </dd>
717: </figure></pre>
718: </div><p class="note">If the <code><a href="#the-li-element">li</a></code> element is the child of a
719: <code><a href="interactive-elements.html#menus">menu</a></code> element and itself has a child that defines a
720: <a href="commands.html#concept-command" title="concept-command">command</a>, then the
721: <code><a href="#the-li-element">li</a></code> element will match the <code title="selector-enabled"><a href="#selector-enabled">:enabled</a></code> and <code title="selector-disabled"><a href="#selector-disabled">:disabled</a></code> pseudo-classes in the
722: same way as the first such child element does.</p><h4 id="the-dl-element"><span class="secno">4.5.9 </span>The <dfn><code>dl</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
723: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
724: <dt>Contexts in which this element may be used:</dt>
725: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
726: <dt>Content model:</dt>
727: <dd>Zero or more groups each consisting of one or more
728: <code><a href="#the-dt-element">dt</a></code> elements followed by one or more <code><a href="#the-dd-element">dd</a></code>
729: elements.</dd>
730: <dt>Content attributes:</dt>
731: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
732: <dt>DOM interface:</dt>
733: <dd>
734: <pre class="idl">interface <dfn id="htmldlistelement">HTMLDListElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {};</pre>
735: </dd>
736: </dl><p>The <code><a href="#the-dl-element">dl</a></code> element <a href="#represents">represents</a> an
737: association list consisting of zero or more name-value groups (a
738: description list). Each group must consist of one or more names
739: (<code><a href="#the-dt-element">dt</a></code> elements) followed by one or more values
740: (<code><a href="#the-dd-element">dd</a></code> elements). Within a single <code><a href="#the-dl-element">dl</a></code> element,
741: there should not be more than one <code><a href="#the-dt-element">dt</a></code> element for each
742: name.</p><p>Name-value groups may be terms and definitions, metadata topics
743: and values, or any other groups of name-value data.</p><p>The values within a group are alternatives; multiple paragraphs
744: forming part of the same value must all be given within the same
745: <code><a href="#the-dd-element">dd</a></code> element.</p><p>The order of the list of groups, and of the names and values
746: within each group, may be significant.</p><div class="example">
747: <p>In the following example, one entry ("Authors") is linked to two
748: values ("John" and "Luke").</p>
749: <pre><dl>
750: <dt> Authors
751: <dd> John
752: <dd> Luke
753: <dt> Editor
754: <dd> Frank
755: </dl></pre>
756: </div><div class="example">
757: <p>In the following example, one definition is linked to two
758: terms.</p>
759: <pre><dl>
760: <dt lang="en-US"> <dfn>color</dfn> </dt>
761: <dt lang="en-GB"> <dfn>colour</dfn> </dt>
762: <dd> A sensation which (in humans) derives from the ability of
763: the fine structure of the eye to distinguish three differently
764: filtered analyses of a view. </dd>
765: </dl></pre>
766: </div><div class="example">
767: <p>The following example illustrates the use of the <code><a href="#the-dl-element">dl</a></code>
768: element to mark up metadata of sorts. At the end of the example,
769: one group has two metadata labels ("Authors" and "Editors") and two
770: values ("Robert Rothman" and "Daniel Jackson").</p>
771: <pre><dl>
772: <dt> Last modified time </dt>
773: <dd> 2004-12-23T23:33Z </dd>
774: <dt> Recommended update interval </dt>
775: <dd> 60s </dd>
776: <dt> Authors </dt>
777: <dt> Editors </dt>
778: <dd> Robert Rothman </dd>
779: <dd> Daniel Jackson </dd>
780: </dl></pre>
781: </div><div class="example">
782:
783: <p>The following example shows the <code><a href="#the-dl-element">dl</a></code> element used to
784: give a set of instructions. The order of the instructions here is
785: important (in the other examples, the order of the blocks was not
786: important).</p>
787:
788: <pre><p>Determine the victory points as follows (use the
789: first matching case):</p>
790: <dl>
791: <dt> If you have exactly five gold coins </dt>
792: <dd> You get five victory points </dd>
793: <dt> If you have one or more gold coins, and you have one or more silver coins </dt>
794: <dd> You get two victory points </dd>
795: <dt> If you have one or more silver coins </dt>
796: <dd> You get one victory point </dd>
797: <dt> Otherwise </dt>
798: <dd> You get no victory points </dd>
799: </dl></pre>
800: </div><div class="example">
801: <p>The following snippet shows a <code><a href="#the-dl-element">dl</a></code> element being used
802: as a glossary. Note the use of <code><a href="text-level-semantics.html#the-dfn-element">dfn</a></code> to indicate the
803: word being defined.</p>
804: <pre><dl>
805: <dt><dfn>Apartment</dfn>, n.</dt>
806: <dd>An execution context grouping one or more threads with one or
807: more COM objects.</dd>
808: <dt><dfn>Flat</dfn>, n.</dt>
809: <dd>A deflated tire.</dd>
810: <dt><dfn>Home</dfn>, n.</dt>
811: <dd>The user's login directory.</dd>
812: </dl></pre>
813: </div><p class="note">The <code><a href="#the-dl-element">dl</a></code> element is inappropriate for
814: marking up dialogue. <a href="commands.html#conversations">Examples of how to
815: mark up dialogue</a> are shown below.</p><h4 id="the-dt-element"><span class="secno">4.5.10 </span>The <dfn><code>dt</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
816: <dd>None.</dd>
817: <dt>Contexts in which this element may be used:</dt>
818: <dd>Before <code><a href="#the-dd-element">dd</a></code> or <code><a href="#the-dt-element">dt</a></code> elements inside <code><a href="#the-dl-element">dl</a></code> elements.</dd>
819: <dd>In a <code><a href="embedded-content-1.html#the-figure-element">figure</a></code> element containing no other <code><a href="#the-dt-element">dt</a></code> element children.</dd>
820: <dd>As the first child of a <code><a href="interactive-elements.html#the-details-element">details</a></code> element.</dd>
821: <dt>Content model:</dt>
822: <dd>When the parent node is a <code><a href="embedded-content-1.html#the-figure-element">figure</a></code> element: <a href="content-models.html#flow-content">flow content</a>, but with no descendant <code><a href="embedded-content-1.html#the-figure-element">figure</a></code> elements.</dd>
823: <dd>Otherwise: <a href="content-models.html#phrasing-content">phrasing content</a>.</dd>
824: <dt>Content attributes:</dt>
825: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
826: <dt>DOM interface:</dt>
827: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
828: </dl><p>The <code><a href="#the-dt-element">dt</a></code> element <a href="#represents">represents</a> either: the
829: term, or name, part of a term-description group in a description
830: list (<code><a href="#the-dl-element">dl</a></code> element); or, the caption of a
831: <code><a href="embedded-content-1.html#the-figure-element">figure</a></code> element; or, the summary of a
832: <code><a href="interactive-elements.html#the-details-element">details</a></code> element.</p><p class="note">The <code><a href="#the-dt-element">dt</a></code> element itself, when used in a
833: <code><a href="#the-dl-element">dl</a></code> element, does not indicate that its contents are a
834: term being defined, but this can be indicated using the
835: <code><a href="text-level-semantics.html#the-dfn-element">dfn</a></code> element.</p><h4 id="the-dd-element"><span class="secno">4.5.11 </span>The <dfn><code>dd</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
836: <dd>None.</dd>
837: <dt>Contexts in which this element may be used:</dt>
838: <dd>After <code><a href="#the-dt-element">dt</a></code> or <code><a href="#the-dd-element">dd</a></code> elements inside <code><a href="#the-dl-element">dl</a></code> elements.</dd>
839: <dd>In a <code><a href="embedded-content-1.html#the-figure-element">figure</a></code> element containing no other <code><a href="#the-dd-element">dd</a></code> element children.</dd>
840: <dd>As the last child of a <code><a href="interactive-elements.html#the-details-element">details</a></code> element.</dd>
841: <dt>Content model:</dt>
842: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
843: <dt>Content attributes:</dt>
844: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
845: <dt>DOM interface:</dt>
846: <dd>Uses <code><a href="elements.html#htmlelement">HTMLElement</a></code>.</dd>
847: </dl><p>The <code><a href="#the-dd-element">dd</a></code> element <a href="#represents">represents</a> either: the
848: description, definition, or value, part of a term-description group
849: in a description list (<code><a href="#the-dl-element">dl</a></code> element); or, the data of a
850: <code><a href="embedded-content-1.html#the-figure-element">figure</a></code> element; or, the details of a
851: <code><a href="interactive-elements.html#the-details-element">details</a></code> element.</p><div class="example">
852:
853: <p>A <code><a href="#the-dl-element">dl</a></code> can be used to define a vocabulary list, like
854: in a dictionary. In the following example, each entry, given by a
855: <code><a href="#the-dt-element">dt</a></code> with a <code><a href="text-level-semantics.html#the-dfn-element">dfn</a></code>, has several
856: <code><a href="#the-dd-element">dd</a></code>s, showing the various parts of the definition.</p>
857:
858: <!-- the actual pronunciations below are nonsense. -->
859: <pre><dl>
860: <dt><dfn>happiness</dfn></dt>
861: <dd class="pronunciation">/'hæ p. nes/</dd>
862: <dd class="part-of-speech"><i><abbr>n.</abbr></i></dd>
863: <dd>The state of being happy.</dd>
864: <dd>Good fortune; success. <q>Oh <b>happiness</b>! It worked!</q></dd>
865: <dt><dfn>rejoice</dfn></dt>
866: <dd class="pronunciation">/ri jois'/</dd>
867: <dd><i class="part-of-speech"><abbr>v.intr.</abbr></i> To be delighted oneself.</dd>
868: <dd><i class="part-of-speech"><abbr>v.tr.</abbr></i> To cause one to be delighted.</dd>
869: </dl></pre>
870: </div><h4 id="the-div-element"><span class="secno">4.5.12 </span>The <dfn><code>div</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
871: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
872: <dd><a href="dnd.html#formatblock-candidate"><code title="">formatBlock</code> candidate</a>.</dd>
873: <dt>Contexts in which this element may be used:</dt>
874: <dd>Where <a href="content-models.html#flow-content">flow content</a> is expected.</dd>
875: <dt>Content model:</dt>
876: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
877: <dt>Content attributes:</dt>
878: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
879: <dt>DOM interface:</dt>
880: <dd>
881: <pre class="idl">interface <dfn id="htmldivelement">HTMLDivElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {};</pre>
882: </dd>
883: </dl><p>The <code><a href="#the-div-element">div</a></code> element has no special meaning at all. It
884: <a href="#represents">represents</a> its children. It can be used with the <code title="attr-class"><a href="elements.html#classes">class</a></code>, <code title="attr-lang"><a href="elements.html#attr-lang">lang</a></code>, and <code title="attr-title"><a href="elements.html#the-title-attribute">title</a></code> attributes to mark up semantics
885: common to a group of consecutive elements.</p><p class="note">Authors are strongly encouraged to view the
886: <code><a href="#the-div-element">div</a></code> element as an element of last resort, for when no
887: other element is suitable. Use of the <code><a href="#the-div-element">div</a></code> element
888: instead of more appropriate elements leads to poor accessibility for
889: readers and poor maintainability for authors.</p><div class="example">
890:
891: <p>For example, a blog post would be marked up using
892: <code><a href="sections.html#the-article-element">article</a></code>, a chapter using <code><a href="sections.html#the-section-element">section</a></code>, a
893: page's navigation aids using <code><a href="sections.html#the-nav-element">nav</a></code>, and a group of form
894: controls using <code><a href="forms.html#the-fieldset-element">fieldset</a></code>.</p>
895:
896: <p>On the other hand, <code><a href="#the-div-element">div</a></code> elements can be useful for
897: stylistic purposes or to wrap multiple paragraphs within a section
898: that are all to be annotated in a similar way. In the following
899: example, we see <code><a href="#the-div-element">div</a></code> elements used as a way to set the
900: language of two paragraphs at once, instead of setting the language
901: on the two paragraph elements separately:</p>
902:
903: <pre><article lang="en-US">
904: <h1>My use of language and my cats</h1>
905: <p>My cat's behavior hasn't changed much since her absence, except
906: that she plays her new physique to the neighbors regularly, in an
907: attempt to get pets.</p>
908: <div lang="en-GB">
909: <p>My other cat, coloured black and white, is a sweetie. He followed
910: us to the pool today, walking down the pavement with us. Yesterday
911: he apparently visited our neighbours. I wonder if he recognises that
912: their flat is a mirror image of ours.</p>
913: <p>Hm, I just noticed that in the last paragraph I used British
914: English. But I'm supposed to write in American English. So I
915: shouldn't say "pavement" or "flat" or "colour"...</p>
916: </div>
917: <p>I should say "sidewalk" and "apartment" and "color"!</p>
918: </article></pre>
919:
920: </div></body></html>
Webmaster