Annotation of html5/spec-author-view/grouping-content.html, revision 1.301
1.298 mike 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><!-- when publishing, change bits marked ZZZ --><html class="split chapter" lang="en-US-x-Hixie"><meta content="text/html; charset=ascii" http-equiv="Content-Type"><title>4.5 Grouping content — HTML5 (Edition for Web Authors)</title><meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport"><meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"><link href="whatwg.css" rel="stylesheet"><style type="text/css">
1.12 mike 2: pre { margin-left: 2em; white-space: pre-wrap; }
3: h2 { margin: 3em 0 1em 0; }
4: h3 { margin: 2.5em 0 1em 0; }
5: h4 { margin: 2.5em 0 0.75em 0; }
6: h5, h6 { margin: 2.5em 0 1em; }
7: h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
8: h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
9: p { margin: 1em 0; }
10: hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
11: dl, dd { margin-top: 0; margin-bottom: 0; }
12: dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
13: dt + dt { margin-top: 0; }
14: dd dt { margin-top: 0.25em; margin-bottom: 0; }
15: dd p { margin-top: 0; }
16: dd dl + p { margin-top: 1em; }
17: dd table + p { margin-top: 1em; }
18: p + * > li, dd li { margin: 1em 0; }
19: dt, dfn { font-weight: bold; font-style: normal; }
20: dt dfn { font-style: italic; }
21: pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
22: pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
23: pre em { font-weight: bolder; font-style: normal; }
24: @media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
25: var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
26: table { border-collapse: collapse; border-style: hidden hidden none hidden; }
1.37 mike 27: table thead, table tbody { border-bottom: solid; }
1.12 mike 28: table tbody th:first-child { border-left: solid; }
29: table tbody th { text-align: left; }
30: table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
31: blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
32:
33: .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
34: .matrix, .matrix td { border: none; text-align: right; }
35: .matrix { margin-left: 2em; }
36: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
37: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
38: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
39:
40: .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
41: img.extra { float: right; }
42: pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; }
43: pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
44: pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
45: pre.css:first-line { color: #AAAA50; }
1.21 mike 46: dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
1.12 mike 47: hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
48: dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
49: dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
50: dl.domintro dd p { margin: 0.5em 0; }
51: dl.switch { padding-left: 2em; }
52: dl.switch > dt { text-indent: -1.5em; }
53: dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
54: dl.triple { padding: 0 0 0 1em; }
55: dl.triple dt, dl.triple dd { margin: 0; display: inline }
56: dl.triple dt:after { content: ':'; }
57: dl.triple dd:after { content: '\A'; white-space: pre; }
58: .diff-old { text-decoration: line-through; color: silver; background: transparent; }
59: .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
60: a .diff-new { border-bottom: 1px blue solid; }
61:
62: h2 { page-break-before: always; }
63: h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
64: h1 + h2, hr + h2.no-toc { page-break-before: auto; }
65:
66: p > span:not([title=""]):not([class="XXX"]):not([class="impl"]), li > span:not([title=""]):not([class="XXX"]):not([class="impl"]) { border-bottom: solid #9999CC; }
67:
68: div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
69: div.head p { margin: 0; }
70: div.head h1 { margin: 0; }
71: div.head .logo { float: right; margin: 0 1em; }
72: div.head .logo img { border: none } /* remove border from top image */
73: div.head dl { margin: 1em 0; }
74: div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
75:
76: body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
77: body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
78: body > .toc > li > * { margin-bottom: 0.5em; }
79: body > .toc > li > * > li > * { margin-bottom: 0.25em; }
80: .toc, .toc li { list-style: none; }
81:
82: .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
83: .brief li { margin: 0; padding: 0; }
84: .brief li p { margin: 0; padding: 0; }
85:
86: .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
87: .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
88: .category-list li { display: inline; }
89: .category-list li:not(:last-child)::after { content: ', '; }
90: .category-list li > span, .category-list li > a { text-transform: lowercase; }
91: .category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
92:
93: .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
94: .XXX > :first-child { margin-top: 0; }
95: p .XXX { line-height: 3em; }
96: .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
97: .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
98: .annotation :link, .annotation :visited { color: inherit; }
99: .annotation :link:hover, .annotation :visited:hover { background: transparent; }
100: .annotation span { border: none ! important; }
101: .note { color: green; background: transparent; font-family: sans-serif; }
102: .warning { color: red; background: transparent; }
103: .note, .warning { font-weight: bolder; font-style: italic; }
104: p.note, div.note { padding: 0.5em 2em; }
105: span.note { padding: 0 2em; }
106: .note p:first-child, .warning p:first-child { margin-top: 0; }
107: .note p:last-child, .warning p:last-child { margin-bottom: 0; }
108: .warning:before { font-style: normal; }
109: p.note:before { content: 'Note: '; }
110: p.warning:before { content: '\26A0 Warning! '; }
111:
112: .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
113: .bookkeeping { font-size: 0.8em; margin: 2em 0; }
114: .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
1.135 mike 115: .bookkeeping dt { margin: 0.5em 2em 0; }
116: .bookkeeping dd { margin: 0 3em 0.5em; }
1.12 mike 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:
1.15 mike 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:
1.12 mike 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; }
1.124 mike 184:
1.295 mike 185: fieldset { margin: 1em; }
186: fieldset > legend * + { margin-top: 0; }
187: fieldset > :last-child { margin-bottom: 0; }
188:
189: .latest-link::after {
190: position: fixed;
191: bottom: 0;
192: left: 0; right: 0;
193: margin: 0 auto 0 auto;
194: width: 50%;
195: background: maroon; color: yellow;
196: -webkit-border-radius: 1em 1em 0 0;
197: -moz-border-radius: 1em 1em 0 0;
198: border-radius: 1em 1em 0 0;
199: -moz-box-shadow: 0 0 1em #500;
200: -webkit-box-shadow: 0 0 1em #500;
201: box-shadow: 0 0 1em silver;
202: padding: 0.5em 1em;
203: text-align: center;
204: text-decoration: underline;
205: white-space: pre-wrap;
206: content: 'This is an out-of-date copy of this specification.\A For the up-to-date version, please view the latest editor\'s draft by following this link.';
207: }
208:
1.12 mike 209: </style><style type="text/css">
210:
211: .applies thead th > * { display: block; }
212: .applies thead code { display: block; }
213: .applies tbody th { whitespace: nowrap; }
214: .applies td { text-align: center; }
215: .applies .yes { background: yellow; }
216:
1.139 mike 217: .matrix, .matrix td { border: hidden; text-align: right; }
1.12 mike 218: .matrix { margin-left: 2em; }
219:
220: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
221: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
222: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
223:
1.215 mike 224: td.eg { border-width: thin; text-align: center; }
225:
1.12 mike 226: #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
227: #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
228: #table-example-1 caption { padding-bottom: 0.5em; }
229: #table-example-1 thead, #table-example-1 tbody { border: none; }
230: #table-example-1 th, #table-example-1 td { border: solid thin; }
231: #table-example-1 th { font-weight: normal; }
232: #table-example-1 td { border-style: none solid; vertical-align: top; }
233: #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
234: #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
235: #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
236: #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
237: #table-example-1 tbody td:first-child::after { content: leader(". "); }
238: #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
239: #table-example-1 tbody td:first-child + td { width: 10em; }
240: #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
241: #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
242:
243: .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
244: .apple-table-examples * { font-family: "Times", serif; }
245: .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
246: .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
247: .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
248: .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
249: .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
250: .apple-table-examples td { text-align: right; vertical-align: top; }
251: .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
252: .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
253: .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
254: .apple-table-examples sup { line-height: 0; }
255:
1.13 mike 256: .details-example img { vertical-align: top; }
257:
1.25 mike 258: #named-character-references-table {
1.259 mike 259: white-space: nowrap;
1.25 mike 260: font-size: 0.6em;
1.259 mike 261: column-width: 30em;
1.25 mike 262: column-gap: 1em;
1.259 mike 263: -moz-column-width: 30em;
1.25 mike 264: -moz-column-gap: 1em;
1.259 mike 265: -webkit-column-width: 30em;
1.25 mike 266: -webkit-column-gap: 1em;
267: }
1.259 mike 268: #named-character-references-table > table > tbody > tr > td:first-child + td,
1.25 mike 269: #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
270: #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; }
1.259 mike 271: #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }
1.25 mike 272:
1.38 mike 273: .glyph.control { color: red; }
274:
1.41 mike 275: @font-face {
276: font-family: 'Essays1743';
277: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
278: }
279: @font-face {
280: font-family: 'Essays1743';
281: font-weight: bold;
282: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
283: }
284: @font-face {
285: font-family: 'Essays1743';
286: font-style: italic;
287: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
288: }
289: @font-face {
290: font-family: 'Essays1743';
291: font-style: italic;
292: font-weight: bold;
293: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
294: }
295:
1.24 mike 296: </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">
1.160 mike 297: function getCookie(name) {
298: var params = location.search.substr(1).split("&");
299: for (var index = 0; index < params.length; index++) {
300: if (params[index] == name)
301: return "1";
302: var data = params[index].split("=");
303: if (data[0] == name)
304: return unescape(data[1]);
1.12 mike 305: }
1.160 mike 306: var cookies = document.cookie.split("; ");
307: for (var index = 0; index < cookies.length; index++) {
308: var data = cookies[index].split("=");
309: if (data[0] == name)
310: return unescape(data[1]);
1.12 mike 311: }
1.160 mike 312: return null;
313: }
314: function load(script) {
315: var e = document.createElement('script');
316: e.setAttribute('src', script + '?' + encodeURIComponent(location) + '&' + encodeURIComponent(document.referrer));
317: document.body.appendChild(e);
318: }
319: function init() {
320: if (location.search == '?slow-browser')
321: return;
322: var configUI = document.createElement('div');
323: configUI.id = 'configUI';
324: document.body.appendChild(configUI);
325: if (document.getElementById('head'))
326: load('toc.js');
327: load('dfn.js');
328: if (getCookie('profile') == '1')
329: document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
330: fixBrokenLink();
331: }
1.295 mike 332: </script><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text/css"><link href="style.css" rel="stylesheet"><script src="link-fixup.js"></script><link href="sections.html" rel="prev" title="4.4 Sections">
1.163 mike 333: <link href="Overview.html#contents" rel="index" title="Table of contents">
334: <link href="text-level-semantics.html" rel="next" title="4.6 Text-level semantics">
335: <body onload="fixBrokenLink(); init()"><div class="head" id="head">
1.12 mike 336: <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
1.39 mike 337:
1.301 ! mike 338: <h1>HTML5 <span class="edition">Edition for Web Authors</span> <span class="rcsrevision">revision 1.4501</span></h1>
1.12 mike 339: </div><div>
1.163 mike 340: <a href="sections.html">← 4.4 Sections</a> –
341: <a href="Overview.html#contents">Table of contents</a> –
342: <a href="text-level-semantics.html">4.6 Text-level semantics →</a>
1.12 mike 343: <ol class="toc"><li><ol><li><a href="grouping-content.html#grouping-content"><span class="secno">4.5 </span>Grouping content</a>
1.163 mike 344: <ol><li><a href="grouping-content.html#the-p-element" id="x4.5.1-the-p-element"><span class="secno">4.5.1 </span>The <code>p</code> element</a><li><a href="grouping-content.html#the-hr-element" id="x4.5.2-the-hr-element"><span class="secno">4.5.2 </span>The <code>hr</code> element</a><li><a href="grouping-content.html#the-pre-element" id="x4.5.3-the-pre-element"><span class="secno">4.5.3 </span>The <code>pre</code> element</a><li><a href="grouping-content.html#the-blockquote-element" id="x4.5.4-the-blockquote-element"><span class="secno">4.5.4 </span>The <code>blockquote</code> element</a><li><a href="grouping-content.html#the-ol-element" id="x4.5.5-the-ol-element"><span class="secno">4.5.5 </span>The <code>ol</code> element</a><li><a href="grouping-content.html#the-ul-element" id="x4.5.6-the-ul-element"><span class="secno">4.5.6 </span>The <code>ul</code> element</a><li><a href="grouping-content.html#the-li-element" id="x4.5.7-the-li-element"><span class="secno">4.5.7 </span>The <code>li</code> element</a><li><a href="grouping-content.html#the-dl-element" id="x4.5.8-the-dl-element"><span class="secno">4.5.8 </span>The <code>dl</code> element</a><li><a href="grouping-content.html#the-dt-element" id="x4.5.9-the-dt-element"><span class="secno">4.5.9 </span>The <code>dt</code> element</a><li><a href="grouping-content.html#the-dd-element" id="x4.5.10-the-dd-element"><span class="secno">4.5.10 </span>The <code>dd</code> element</a><li><a href="grouping-content.html#the-figure-element" id="x4.5.11-the-figure-element"><span class="secno">4.5.11 </span>The <code>figure</code> element</a><li><a href="grouping-content.html#the-figcaption-element" id="x4.5.12-the-figcaption-element"><span class="secno">4.5.12 </span>The <code>figcaption</code> element</a><li><a href="grouping-content.html#the-div-element" id="x4.5.13-the-div-element"><span class="secno">4.5.13 </span>The <code>div</code> element</a></ol></ol></ol></div>
1.12 mike 345:
1.204 mike 346: <h3 id="grouping-content"><span class="secno">4.5 </span>Grouping content</h3><h4 id="the-p-element"><span class="secno">4.5.1 </span>The <dfn><code>p</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.205 mike 347: <dd><a href="content-models.html#flow-content" id="flow-content-40">Flow content</a>.</dd>
1.159 mike 348: <dd><a href="dnd.html#formatblock-candidate" id="formatblock-candidate-9"><code title="">formatBlock</code> candidate</a>.</dd>
1.205 mike 349: <dt>Contexts in which this element can be used:</dt>
350: <dd>Where <a href="content-models.html#flow-content" id="flow-content-41">flow content</a> is expected.</dd>
1.12 mike 351: <dt>Content model:</dt>
1.205 mike 352: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-21">Phrasing content</a>.</dd>
1.12 mike 353: <dt>Content attributes:</dt>
1.159 mike 354: <dd><a href="elements.html#global-attributes" id="global-attributes-19">Global attributes</a></dd>
1.12 mike 355: <dt>DOM interface:</dt>
356: <dd>
1.159 mike 357: <pre class="idl">interface <dfn id="htmlparagraphelement">HTMLParagraphElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-26">HTMLElement</a> {};</pre>
1.12 mike 358: </dd>
1.264 mike 359: </dl><p>The <code><a href="#the-p-element" id="p-10">p</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a
1.189 mike 360: <a href="content-models.html#paragraph" id="paragraph-5">paragraph</a>.<p class="note">While paragraphs are usually represented in visual
361: media by blocks of text that are physically separated from adjacent
362: blocks through blank lines, a style sheet or user agent would be
363: equally justified in presenting paragraph breaks in a different
364: manner, for instance using inline pilcrows (¶).<div class="example">
1.12 mike 365: <p>The following examples are conforming HTML fragments:</p>
366: <pre><p>The little kitten gently seated himself on a piece of
367: carpet. Later in his life, this would be referred to as the time the
368: cat sat on the mat.</p></pre>
369: <pre><fieldset>
370: <legend>Personal information</legend>
371: <p>
372: <label>Name: <input name="n"></label>
373: <label><input name="anon" type="checkbox"> Hide from other users</label>
374: </p>
375: <p><label>Address: <textarea name="a"></textarea></label></p>
376: </fieldset></pre>
377: <pre><p>There was once an example from Femley,<br>
378: Whose markup was of dubious quality.<br>
379: The validator complained,<br>
380: So the author was pained,<br>
381: To move the error from the markup to the rhyming.</p></pre>
1.264 mike 382: </div><p>The <code><a href="#the-p-element" id="p-11">p</a></code> element should not be used when a more
1.163 mike 383: specific element is more appropriate.<div class="example">
1.12 mike 384:
385: <p>The following example is technically correct:</p>
386:
387: <pre><section>
388: <!-- ... -->
389: <p>Last modified: 2001-04-23</p>
390: <p>Author: fred@example.com</p>
391: </section></pre>
392:
393: <p>However, it would be better marked-up as:</p>
394:
395: <pre><section>
396: <!-- ... -->
397: <footer>Last modified: 2001-04-23</footer>
398: <address>Author: fred@example.com</address>
399: </section></pre>
400:
401: <p>Or:</p>
402:
403: <pre><section>
404: <!-- ... -->
405: <footer>
406: <p>Last modified: 2001-04-23</p>
407: <address>Author: fred@example.com</address>
408: </footer>
409: </section></pre>
410:
1.204 mike 411: </div><h4 id="the-hr-element"><span class="secno">4.5.2 </span>The <dfn><code>hr</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.205 mike 412: <dd><a href="content-models.html#flow-content" id="flow-content-42">Flow content</a>.</dd>
413: <dt>Contexts in which this element can be used:</dt>
414: <dd>Where <a href="content-models.html#flow-content" id="flow-content-43">flow content</a> is expected.</dd>
1.12 mike 415: <dt>Content model:</dt>
416: <dd>Empty.</dd>
417: <dt>Content attributes:</dt>
1.159 mike 418: <dd><a href="elements.html#global-attributes" id="global-attributes-20">Global attributes</a></dd>
1.12 mike 419: <dt>DOM interface:</dt>
420: <dd>
1.159 mike 421: <pre class="idl">interface <dfn id="htmlhrelement">HTMLHRElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-27">HTMLElement</a> {};</pre>
1.12 mike 422: </dd>
1.165 mike 423: </dl><p>The <code><a href="#the-hr-element" id="hr-3">hr</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a
1.159 mike 424: <a href="content-models.html#paragraph" id="paragraph-6">paragraph</a>-level thematic break, e.g. a scene change in
1.12 mike 425: a story, or a transition to another topic within a section of a
1.163 mike 426: reference book.<div class="example">
1.12 mike 427:
1.33 mike 428: <p>The following fictional extract from a project manual shows two
1.159 mike 429: sections that use the <code><a href="#the-hr-element" id="hr-4">hr</a></code> element to separate topics
1.33 mike 430: within the section.</p>
431:
432: <pre><section>
433: <h1>Communication</h1>
434: <p>There are various methods of communication. This section
435: covers a few of the important ones used by the project.</p>
436: <strong><hr></strong>
437: <p>Communication stones seem to come in pairs and have mysterious
438: properties:</p>
439: <ul>
440: <li>They can transfer thoughts in two directions once activated
441: if used alone.</li>
442: <li>If used with another device, they can transfer one's
443: consciousness to another body.</li>
444: <li>If both stones are used with another device, the
445: consciousnesses switch bodies.</li>
446: </ul>
447: <strong><hr></strong>
448: <p>Radios use the electromagnetic spectrum in the meter range and
449: longer.</p>
450: <strong><hr></strong>
451: <p>Signal flares use the electromagnetic spectrum in the
452: nanometer range.</p>
453: </section>
454: <section>
455: <h1>Food</h1>
456: <p>All food at the project is rationed:</p>
457: <dl>
458: <dt>Potatoes</dt>
459: <dd>Two per day</dd>
460: <dt>Soup</dt>
461: <dd>One bowl per day</dd>
462: </dl>
463: <strong><hr></strong>
464: <p>Cooking is done by the chefs on a set rotation.</p>
465: </section></pre>
466:
1.159 mike 467: <p>There is no need for an <code><a href="#the-hr-element" id="hr-5">hr</a></code> element between the
468: sections themselves, since the <code><a href="sections.html#the-section-element" id="section-11">section</a></code> elements and
1.264 mike 469: the <code><a href="sections.html#the-h1-h2-h3-h4-h5-and-h6-elements" id="h1-16">h1</a></code> elements imply thematic changes themselves.</p>
1.33 mike 470:
471: </div><div class="example">
472:
1.12 mike 473: <p>The following extract from <cite>Pandora's Star</cite> by Peter
474: F. Hamilton shows two paragraphs that precede a scene change and
475: the paragraph that follows it. The scene change, represented in the
476: printed book by a gap containing a solitary centered star between
477: the second and third paragraphs, is here represented using the
1.159 mike 478: <code><a href="#the-hr-element" id="hr-6">hr</a></code> element.</p>
1.12 mike 479:
480: <!-- ISBN 1-4050-0020-1; bottom of page 14 -->
481:
482: <pre lang="en-GB"><p>Dudley was ninety-two, in his second life, and fast approaching
483: time for another rejuvenation. Despite his body having the physical
484: age of a standard fifty-year-old, the prospect of a long degrading
485: campaign within academia was one he regarded with dread. For a
486: supposedly advanced civilization, the Intersolar Commonwearth could be
487: appallingly backward at times, not to mention cruel.</p>
488: <p><i>Maybe it won't be that bad</i>, he told himself. The lie was
489: comforting enough to get him through the rest of the night's
490: shift.</p>
491: <strong><hr></strong>
492: <p>The Carlton AllLander drove Dudley home just after dawn. Like the
493: astronomer, the vehicle was old and worn, but perfectly capable of
494: doing its job. It had a cheap diesel engine, common enough on a
495: semi-frontier world like Gralmond, although its drive array was a
496: thoroughly modern photoneural processor. With its high suspension and
497: deep-tread tyres it could plough along the dirt track to the
498: observatory in all weather and seasons, including the metre-deep snow
499: of Gralmond's winters.</p></pre>
500:
1.159 mike 501: </div><p class="note">The <code><a href="#the-hr-element" id="hr-7">hr</a></code> element does not affect the
1.204 mike 502: document's <a href="sections.html#outline" id="outline-5">outline</a>.<h4 id="the-pre-element"><span class="secno">4.5.3 </span>The <dfn><code>pre</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.205 mike 503: <dd><a href="content-models.html#flow-content" id="flow-content-44">Flow content</a>.</dd>
1.159 mike 504: <dd><a href="dnd.html#formatblock-candidate" id="formatblock-candidate-10"><code title="">formatBlock</code> candidate</a>.</dd>
1.205 mike 505: <dt>Contexts in which this element can be used:</dt>
506: <dd>Where <a href="content-models.html#flow-content" id="flow-content-45">flow content</a> is expected.</dd>
1.12 mike 507: <dt>Content model:</dt>
1.205 mike 508: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-22">Phrasing content</a>.</dd>
1.12 mike 509: <dt>Content attributes:</dt>
1.159 mike 510: <dd><a href="elements.html#global-attributes" id="global-attributes-21">Global attributes</a></dd>
1.12 mike 511: <dt>DOM interface:</dt>
512: <dd>
1.159 mike 513: <pre class="idl">interface <dfn id="htmlpreelement">HTMLPreElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-28">HTMLElement</a> {};</pre>
1.12 mike 514: </dd>
1.264 mike 515: </dl><p>The <code><a href="#the-pre-element" id="pre-0">pre</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a block of
1.12 mike 516: preformatted text, in which structure is represented by typographic
1.163 mike 517: conventions rather than by elements.<p class="note">In <a href="syntax.html#syntax" id="the-html-syntax-3">the HTML syntax</a>, a leading
1.264 mike 518: newline character immediately following the <code><a href="#the-pre-element" id="pre-1">pre</a></code> element
519: start tag is stripped.<p>Some examples of cases where the <code><a href="#the-pre-element" id="pre-2">pre</a></code> element could
1.163 mike 520: be used:<ul><li>Including an e-mail, with paragraphs indicated by blank lines,
1.12 mike 521: lists indicated by lines prefixed with a bullet, and so on.</li>
522:
523: <li>Including fragments of computer code, with structure indicated
524: according to the conventions of that language.</li>
525:
526: <li>Displaying ASCII art.</li>
527:
528: </ul><p class="note">Authors are encouraged to consider how preformatted
529: text will be experienced when the formatting is lost, as will be the
530: case for users of speech synthesizers, braille displays, and the
531: like. For cases like ASCII art, it is likely that an alternative
532: presentation, such as a textual description, would be more
1.264 mike 533: universally accessible to the readers of the document.<p>To represent a block of computer code, the <code><a href="#the-pre-element" id="pre-3">pre</a></code>
534: element can be used with a <code><a href="text-level-semantics.html#the-code-element" id="code-1">code</a></code> element; to represent a
535: block of computer output the <code><a href="#the-pre-element" id="pre-4">pre</a></code> element can be used
536: with a <code><a href="text-level-semantics.html#the-samp-element" id="samp-1">samp</a></code> element. Similarly, the <code><a href="text-level-semantics.html#the-kbd-element" id="kbd-2">kbd</a></code>
537: element can be used within a <code><a href="#the-pre-element" id="pre-5">pre</a></code> element to indicate
1.163 mike 538: text that the user is to enter.<div class="example">
1.12 mike 539:
540: <p>In the following snippet, a sample of computer code is
541: presented.</p>
542:
543: <pre><p>This is the <code>Panel</code> constructor:</p>
544: <pre><code>function Panel(element, canClose, closeHandler) {
545: this.element = element;
546: this.canClose = canClose;
547: this.closeHandler = function () { if (closeHandler) closeHandler() };
548: }</code></pre></pre>
549:
550: </div><div class="example">
551:
1.264 mike 552: <p>In the following snippet, <code><a href="text-level-semantics.html#the-samp-element" id="samp-2">samp</a></code> and <code><a href="text-level-semantics.html#the-kbd-element" id="kbd-3">kbd</a></code>
553: elements are mixed in the contents of a <code><a href="#the-pre-element" id="pre-6">pre</a></code> element to
1.12 mike 554: show a session of Zork I.</p>
555:
556: <pre><pre><samp>You are in an open field west of a big white house with a boarded
557: front door.
558: There is a small mailbox here.
559:
560: ></samp> <kbd>open mailbox</kbd>
561:
562: <samp>Opening the mailbox reveals:
563: A leaflet.
564:
565: ></samp></pre></pre>
566:
567: </div><div class="example">
568:
569: <p>The following shows a contemporary poem that uses the
1.264 mike 570: <code><a href="#the-pre-element" id="pre-7">pre</a></code> element to preserve its unusual formatting, which
1.12 mike 571: forms an intrinsic part of the poem itself.</p>
572:
573: <pre><pre> maxling
574:
575: it is with a heart
576: heavy
577:
578: that i admit loss of a feline
579: so loved
580:
581: a friend lost to the
582: unknown
583: (night)
584:
585: ~cdr 11dec07</pre></pre>
586:
1.204 mike 587: </div><h4 id="the-blockquote-element"><span class="secno">4.5.4 </span>The <dfn><code>blockquote</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.205 mike 588: <dd><a href="content-models.html#flow-content" id="flow-content-46">Flow content</a>.</dd>
1.159 mike 589: <dd><a href="sections.html#sectioning-root" id="sectioning-root-6">Sectioning root</a>.</dd>
590: <dd><a href="dnd.html#formatblock-candidate" id="formatblock-candidate-11"><code title="">formatBlock</code> candidate</a>.</dd>
1.205 mike 591: <dt>Contexts in which this element can be used:</dt>
592: <dd>Where <a href="content-models.html#flow-content" id="flow-content-47">flow content</a> is expected.</dd>
1.12 mike 593: <dt>Content model:</dt>
1.205 mike 594: <dd><a href="content-models.html#flow-content" id="flow-content-48">Flow content</a>.</dd>
1.12 mike 595: <dt>Content attributes:</dt>
1.159 mike 596: <dd><a href="elements.html#global-attributes" id="global-attributes-22">Global attributes</a></dd>
597: <dd><code title="attr-blockquote-cite"><a href="#attr-blockquote-cite" id="cite">cite</a></code></dd>
1.12 mike 598: <dt>DOM interface:</dt>
599: <dd>
1.159 mike 600: <pre class="idl">interface <dfn id="htmlquoteelement">HTMLQuoteElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-29">HTMLElement</a> {
1.165 mike 601: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/grouping-content.html#dom-quote-cite" title='Read about this "cite" reference in the full HTML5 spec.'>cite</a>;
1.12 mike 602: };</pre>
1.159 mike 603: <p class="note">The <code><a href="#htmlquoteelement" id="htmlquoteelement-0">HTMLQuoteElement</a></code> interface is
1.264 mike 604: also used by the <code><a href="text-level-semantics.html#the-q-element" id="q-2">q</a></code> element.</p>
1.12 mike 605: </dd>
1.264 mike 606: </dl><p>The <code><a href="#the-blockquote-element" id="blockquote-2">blockquote</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a
607: section that is quoted from another source.<p>Content inside a <code><a href="#the-blockquote-element" id="blockquote-3">blockquote</a></code> must be quoted from
1.35 mike 608: another source, whose address, if it has one, may be cited in the
1.12 mike 609: <dfn id="attr-blockquote-cite" title="attr-blockquote-cite"><code>cite</code></dfn>
1.163 mike 610: attribute.<p>If the <code title="attr-blockquote-cite"><a href="#attr-blockquote-cite" id="cite-0">cite</a></code> attribute
1.159 mike 611: is present, it must be a <a href="urls.html#valid-url-potentially-surrounded-by-spaces" id="valid-url-potentially-surrounded-by-spaces-1">valid URL potentially surrounded by
1.163 mike 612: spaces</a>. <div class="example">
1.12 mike 613:
1.264 mike 614: <p>This next example shows the use of <code><a href="text-level-semantics.html#the-cite-element" id="cite-5">cite</a></code> alongside
615: <code><a href="#the-blockquote-element" id="blockquote-4">blockquote</a></code>:</p>
1.12 mike 616:
617: <pre><p>His next piece was the aptly named <cite>Sonnet 130</cite>:</p>
618: <blockquote cite="http://quotes.example.org/s/sonnet130.html">
619: <p>My mistress' eyes are nothing like the sun,<br>
620: Coral is far more red, than her lips red,<br>
621: ...</pre>
622:
623: </div><div class="example">
624:
625: <p>This example shows how a forum post could use
1.264 mike 626: <code><a href="#the-blockquote-element" id="blockquote-5">blockquote</a></code> to show what post a user is replying
1.159 mike 627: to. The <code><a href="sections.html#the-article-element" id="article-14">article</a></code> element is used for each post, to mark
1.12 mike 628: up the threading.</p>
629:
630: <pre><article>
631: <h1><a href="http://bacon.example.com/?blog=109431">Bacon on a crowbar</a></h1>
632: <article>
633: <header><strong>t3yw</strong> 12 points 1 hour ago</header>
634: <p>I bet a narwhal would love that.</p>
635: <footer><a href="?pid=29578">permalink</a></footer>
636: <article>
637: <header><strong>greg</strong> 8 points 1 hour ago</header>
638: <blockquote><p>I bet a narwhal would love that.</p></blockquote>
639: <p>Dude narwhals don't eat bacon.</p>
640: <footer><a href="?pid=29579">permalink</a></footer>
641: <article>
642: <header><strong>t3yw</strong> 15 points 1 hour ago</header>
643: <blockquote>
644: <blockquote><p>I bet a narwhal would love that.</p></blockquote>
645: <p>Dude narwhals don't eat bacon.</p>
646: </blockquote>
647: <p>Next thing you'll be saying they don't get capes and wizard
648: hats either!</p>
649: <footer><a href="?pid=29580">permalink</a></footer>
650: <article>
651: <article>
652: <header><strong>boing</strong> -5 points 1 hour ago</header>
653: <p>narwhals are worse than ceiling cat</p>
654: <footer><a href="?pid=29581">permalink</a></footer>
655: </article>
656: </article>
657: </article>
658: </article>
659: <article>
660: <header><strong>fred</strong> 1 points 23 minutes ago</header>
661: <blockquote><p>I bet a narwhal would love that.</p></blockquote>
662: <p>I bet they'd love to peel a banana too.</p>
663: <footer><a href="?pid=29582">permalink</a></footer>
664: </article>
665: </article>
666: </article></pre>
667:
1.16 mike 668: </div><p class="note"><a href="links.html#conversations">Examples of how to
1.12 mike 669: represent a conversation</a> are shown in a later section; it is not
1.264 mike 670: appropriate to use the <code><a href="text-level-semantics.html#the-cite-element" id="cite-6">cite</a></code> and <code><a href="#the-blockquote-element" id="blockquote-6">blockquote</a></code>
1.204 mike 671: elements for this purpose.<h4 id="the-ol-element"><span class="secno">4.5.5 </span>The <dfn><code>ol</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.205 mike 672: <dd><a href="content-models.html#flow-content" id="flow-content-49">Flow content</a>.</dd>
673: <dt>Contexts in which this element can be used:</dt>
674: <dd>Where <a href="content-models.html#flow-content" id="flow-content-50">flow content</a> is expected.</dd>
1.12 mike 675: <dt>Content model:</dt>
1.264 mike 676: <dd>Zero or more <code><a href="#the-li-element" id="li-2">li</a></code> elements.</dd>
1.12 mike 677: <dt>Content attributes:</dt>
1.159 mike 678: <dd><a href="elements.html#global-attributes" id="global-attributes-23">Global attributes</a></dd>
679: <dd><code title="attr-ol-reversed"><a href="#attr-ol-reversed" id="reversed">reversed</a></code></dd>
680: <dd><code title="attr-ol-start"><a href="#attr-ol-start" id="start">start</a></code></dd>
1.215 mike 681: <dd><code title="attr-ol-type"><a href="#attr-ol-type" id="type-16">type</a></code></dd>
1.12 mike 682: <dt>DOM interface:</dt>
683: <dd>
1.159 mike 684: <pre class="idl">interface <dfn id="htmlolistelement">HTMLOListElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-30">HTMLElement</a> {
1.165 mike 685: attribute boolean <a class="full-spec-link" href="http://dev.w3.org/html5/spec/grouping-content.html#dom-ol-reversed" title='Read about this "reversed" reference in the full HTML5 spec.'>reversed</a>;
686: attribute long <a class="full-spec-link" href="http://dev.w3.org/html5/spec/grouping-content.html#dom-ol-start" title='Read about this "start" reference in the full HTML5 spec.'>start</a>;
1.215 mike 687: attribute DOMString <a class="full-spec-link" href="http://dev.w3.org/html5/spec/obsolete.html#dom-ol-type" title='Read about this "type" reference in the full HTML5 spec.'>type</a>;
1.12 mike 688: };</pre>
689: </dd>
1.165 mike 690: </dl><p>The <code><a href="#the-ol-element" id="ol-4">ol</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a list of
1.12 mike 691: items, where the items have been intentionally ordered, such that
1.264 mike 692: changing the order would change the meaning of the document.<p>The items of the list are the <code><a href="#the-li-element" id="li-3">li</a></code> element child nodes
1.163 mike 693: of the <code><a href="#the-ol-element" id="ol-5">ol</a></code> element, in <a href="infrastructure.html#tree-order" id="tree-order-4">tree order</a>.<p>The <dfn id="attr-ol-reversed" title="attr-ol-reversed"><code>reversed</code></dfn>
1.159 mike 694: attribute is a <a href="common-microsyntaxes.html#boolean-attribute" id="boolean-attribute-2">boolean attribute</a>. If present, it
1.12 mike 695: indicates that the list is a descending list (..., 3, 2, 1). If the
696: attribute is omitted, the list is an ascending list (1, 2, 3,
1.163 mike 697: ...).<p>The <dfn id="attr-ol-start" title="attr-ol-start"><code>start</code></dfn>
1.159 mike 698: attribute, if present, must be a <a href="common-microsyntaxes.html#valid-integer" id="valid-integer-3">valid integer</a> giving
1.215 mike 699: the <a href="#ordinal-value" id="ordinal-value-0">ordinal value</a> of the first list item.<p>The <dfn id="attr-ol-type" title="attr-ol-type"><code>type</code></dfn> attribute
700: can be used to specify the kind of marker to use in the list, in the
701: cases where that matters (e.g. because items are to be referened by
702: their number/letter). The attribute, if specified, must have a value
703: that is a <a href="infrastructure.html#case-sensitive" id="case-sensitive-2">case-sensitive</a> match for one of the
704: characters given in the first cell of one of the rows of the
705: following table. <table><thead><tr><th>Keyword
706: <th>State
707: <th>Description
708: <th colspan="8">Examples for values 1-3 and 3999-4001
709: <tbody><tr><td><dfn id="attr-ol-type-keyword-decimal" title="attr-ol-type-keyword-decimal"><code>1</code></dfn> (U+0031)
710: <td><dfn id="attr-ol-type-state-decimal" title="attr-ol-type-state-decimal">decimal</dfn>
711: <td>Decimal numbers
712: <td class="eg"><samp>1.</samp> <td class="eg"><samp>2.</samp> <td class="eg"><samp>3.</samp> <td class="eg">... <td class="eg"><samp>3999.</samp> <td class="eg"><samp>4000.</samp> <td class="eg"><samp>4001.</samp> <td class="eg">...
713: <tr><td><dfn id="attr-ol-type-keyword-lower-alpha" title="attr-ol-type-keyword-lower-alpha"><code>a</code></dfn> (U+0061)
714: <td><dfn id="attr-ol-type-state-lower-alpha" title="attr-ol-type-state-lower-alpha">lower-alpha</dfn>
715: <td>Lowercase latin alphabet
716: <td class="eg"><samp>a.</samp> <td class="eg"><samp>b.</samp> <td class="eg"><samp>c.</samp> <td class="eg">... <td class="eg"><samp>ewu.</samp> <td class="eg"><samp>ewv.</samp> <td class="eg"><samp>eww.</samp> <td class="eg">...
717: <tr><td><dfn id="attr-ol-type-keyword-upper-alpha" title="attr-ol-type-keyword-upper-alpha"><code>A</code></dfn> (U+0041)
718: <td><dfn id="attr-ol-type-state-upper-alpha" title="attr-ol-type-state-upper-alpha">upper-alpha</dfn>
719: <td>Uppercase latin alphabet
720: <td class="eg"><samp>A.</samp> <td class="eg"><samp>B.</samp> <td class="eg"><samp>C.</samp> <td class="eg">... <td class="eg"><samp>EWU.</samp> <td class="eg"><samp>EWV.</samp> <td class="eg"><samp>EWW.</samp> <td class="eg">...
721: <tr><td><dfn id="attr-ol-type-keyword-lower-roman" title="attr-ol-type-keyword-lower-roman"><code>i</code></dfn> (U+0069)
722: <td><dfn id="attr-ol-type-state-lower-roman" title="attr-ol-type-state-lower-roman">lower-roman</dfn>
723: <td>Lowercase roman numerals
724: <td class="eg"><samp>i.</samp> <td class="eg"><samp>ii.</samp> <td class="eg"><samp>iii.</samp> <td class="eg">... <td class="eg"><samp>mmmcmxcix.</samp> <td class="eg"><samp>i̅v̅.</samp> <td class="eg"><samp>i̅v̅i.</samp> <td class="eg">...
725: <tr><td><dfn id="attr-ol-type-keyword-upper-roman" title="attr-ol-type-keyword-upper-roman"><code>I</code></dfn> (U+0049)
726: <td><dfn id="attr-ol-type-state-upper-roman" title="attr-ol-type-state-upper-roman">upper-roman</dfn>
727: <td>Uppercase roman numerals
728: <td class="eg"><samp>I.</samp> <td class="eg"><samp>II.</samp> <td class="eg"><samp>III.</samp> <td class="eg">... <td class="eg"><samp>MMMCMXCIX.</samp> <td class="eg"><samp>I̅V̅.</samp> <td class="eg"><samp>I̅V̅I.</samp> <td class="eg">...
729: </table><!-- v2: resuming numbering of lists from previous lists? --><div class="example">
1.12 mike 730:
731: <p>The following markup shows a list where the order matters, and
1.159 mike 732: where the <code><a href="#the-ol-element" id="ol-6">ol</a></code> element is therefore appropriate. Compare
733: this list to the equivalent list in the <code><a href="#the-ul-element" id="ul-4">ul</a></code> section to
734: see an example of the same items using the <code><a href="#the-ul-element" id="ul-5">ul</a></code>
1.12 mike 735: element.</p>
736:
737: <pre><p>I have lived in the following countries (given in the order of when
738: I first lived there):</p>
739: <ol>
740: <li>Switzerland
741: <li>United Kingdom
742: <li>United States
743: <li>Norway
744: </ol></pre>
745:
746: <p>Note how changing the order of the list changes the meaning of
747: the document. In the following example, changing the relative order
748: of the first two items has changed the birthplace of the
749: author:</p>
750:
751: <pre><p>I have lived in the following countries (given in the order of when
752: I first lived there):</p>
753: <ol>
754: <li>United Kingdom
755: <li>Switzerland
756: <li>United States
757: <li>Norway
758: </ol></pre>
759:
1.204 mike 760: </div><h4 id="the-ul-element"><span class="secno">4.5.6 </span>The <dfn><code>ul</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.205 mike 761: <dd><a href="content-models.html#flow-content" id="flow-content-51">Flow content</a>.</dd>
762: <dt>Contexts in which this element can be used:</dt>
763: <dd>Where <a href="content-models.html#flow-content" id="flow-content-52">flow content</a> is expected.</dd>
1.12 mike 764: <dt>Content model:</dt>
1.264 mike 765: <dd>Zero or more <code><a href="#the-li-element" id="li-4">li</a></code> elements.</dd>
1.12 mike 766: <dt>Content attributes:</dt>
1.159 mike 767: <dd><a href="elements.html#global-attributes" id="global-attributes-24">Global attributes</a></dd>
1.12 mike 768: <dt>DOM interface:</dt>
769: <dd>
1.159 mike 770: <pre class="idl">interface <dfn id="htmlulistelement">HTMLUListElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-31">HTMLElement</a> {};</pre>
1.12 mike 771: </dd>
1.165 mike 772: </dl><p>The <code><a href="#the-ul-element" id="ul-6">ul</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a list of
1.163 mike 773: items, where the order of the items is not important — that
1.12 mike 774: is, where changing the order would not materially change the meaning
1.264 mike 775: of the document.<p>The items of the list are the <code><a href="#the-li-element" id="li-5">li</a></code> element child nodes
1.163 mike 776: of the <code><a href="#the-ul-element" id="ul-7">ul</a></code> element.<div class="example">
1.12 mike 777:
778: <p>The following markup shows a list where the order does not
1.159 mike 779: matter, and where the <code><a href="#the-ul-element" id="ul-8">ul</a></code> element is therefore
1.12 mike 780: appropriate. Compare this list to the equivalent list in the
1.159 mike 781: <code><a href="#the-ol-element" id="ol-7">ol</a></code> section to see an example of the same items using
782: the <code><a href="#the-ol-element" id="ol-8">ol</a></code> element.</p>
1.12 mike 783:
784: <pre><p>I have lived in the following countries:</p>
785: <ul>
786: <li>Norway
787: <li>Switzerland
788: <li>United Kingdom
789: <li>United States
790: </ul></pre>
791:
792: <p>Note that changing the order of the list does not change the
793: meaning of the document. The items in the snippet above are given
794: in alphabetical order, but in the snippet below they are given in
795: order of the size of their current account balance in 2007, without
796: changing the meaning of the document whatsoever:</p>
797:
798: <pre><p>I have lived in the following countries:</p>
799: <ul>
800: <li>Switzerland
801: <li>Norway
802: <li>United Kingdom
803: <li>United States
804: </ul></pre>
805:
1.204 mike 806: </div><h4 id="the-li-element"><span class="secno">4.5.7 </span>The <dfn><code>li</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.12 mike 807: <dd>None.</dd>
1.205 mike 808: <dt>Contexts in which this element can be used:</dt>
1.159 mike 809: <dd>Inside <code><a href="#the-ol-element" id="ol-9">ol</a></code> elements.</dd>
810: <dd>Inside <code><a href="#the-ul-element" id="ul-9">ul</a></code> elements.</dd>
1.264 mike 811: <dd>Inside <code><a href="interactive-elements.html#menus" id="menu-8">menu</a></code> elements.</dd>
1.12 mike 812: <dt>Content model:</dt>
1.205 mike 813: <dd><a href="content-models.html#flow-content" id="flow-content-53">Flow content</a>.</dd>
1.12 mike 814: <dt>Content attributes:</dt>
1.159 mike 815: <dd><a href="elements.html#global-attributes" id="global-attributes-25">Global attributes</a></dd>
816: <dd>If the element is a child of an <code><a href="#the-ol-element" id="ol-10">ol</a></code> element: <code title="attr-li-value"><a href="#attr-li-value" id="value">value</a></code></dd>
1.12 mike 817: <dt>DOM interface:</dt>
818: <dd>
1.159 mike 819: <pre class="idl">interface <dfn id="htmllielement">HTMLLIElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-32">HTMLElement</a> {
1.165 mike 820: attribute long <a class="full-spec-link" href="http://dev.w3.org/html5/spec/grouping-content.html#dom-li-value" title='Read about this "value" reference in the full HTML5 spec.'>value</a>;
1.12 mike 821: };</pre>
822: </dd>
1.264 mike 823: </dl><p>The <code><a href="#the-li-element" id="li-6">li</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a list
1.159 mike 824: item. If its parent element is an <code><a href="#the-ol-element" id="ol-11">ol</a></code>, <code><a href="#the-ul-element" id="ul-10">ul</a></code>,
1.264 mike 825: or <code><a href="interactive-elements.html#menus" id="menu-9">menu</a></code> element, then the element is an item of the
1.12 mike 826: parent element's list, as defined for those elements. Otherwise, the
827: list item has no defined list-related relationship to any other
1.264 mike 828: <code><a href="#the-li-element" id="li-7">li</a></code> element.<p>If the parent element is an <code><a href="#the-ol-element" id="ol-12">ol</a></code> element, then the
829: <code><a href="#the-li-element" id="li-8">li</a></code> element has an <dfn id="ordinal-value">ordinal value</dfn>.<p>The <dfn id="attr-li-value" title="attr-li-value"><code>value</code></dfn>
1.159 mike 830: attribute, if present, must be a <a href="common-microsyntaxes.html#valid-integer" id="valid-integer-4">valid integer</a> giving
1.184 mike 831: the <a href="#ordinal-value" id="ordinal-value-1">ordinal value</a> of the list item.<div class="example">
1.12 mike 832: <p>The following example, the top ten movies are listed (in reverse
833: order). Note the way the list is given a title by using a
1.264 mike 834: <code><a href="#the-figure-element" id="figure-1">figure</a></code> element and its <code><a href="#the-figcaption-element" id="figcaption">figcaption</a></code>
1.14 mike 835: element.</p>
1.12 mike 836: <pre><figure>
1.14 mike 837: <figcaption>The top 10 movies of all time</figcaption>
838: <ol>
839: <li value="10"><cite>Josie and the Pussycats</cite>, 2001</li>
1.58 mike 840: <li value="9"><cite lang="sh">Црна мачка, бели мачор</cite>, 1998</li>
1.14 mike 841: <li value="8"><cite>A Bug's Life</cite>, 1998</li>
842: <li value="7"><cite>Toy Story</cite>, 1995</li>
843: <li value="6"><cite>Monsters, Inc</cite>, 2001</li>
844: <li value="5"><cite>Cars</cite>, 2006</li>
845: <li value="4"><cite>Toy Story 2</cite>, 1999</li>
846: <li value="3"><cite>Finding Nemo</cite>, 2003</li>
847: <li value="2"><cite>The Incredibles</cite>, 2004</li>
848: <li value="1"><cite>Ratatouille</cite>, 2007</li>
849: </ol>
1.12 mike 850: </figure></pre>
851:
1.159 mike 852: <p>The markup could also be written as follows, using the <code title="attr-ol-reversed"><a href="#attr-ol-reversed" id="reversed-0">reversed</a></code> attribute on the
1.184 mike 853: <code><a href="#the-ol-element" id="ol-13">ol</a></code> element:</p>
1.12 mike 854:
855: <pre><figure>
1.14 mike 856: <figcaption>The top 10 movies of all time</figcaption>
857: <ol reversed>
858: <li><cite>Josie and the Pussycats</cite>, 2001</li>
1.58 mike 859: <li><cite lang="sh">Црна мачка, бели мачор</cite>, 1998</li>
1.14 mike 860: <li><cite>A Bug's Life</cite>, 1998</li>
861: <li><cite>Toy Story</cite>, 1995</li>
862: <li><cite>Monsters, Inc</cite>, 2001</li>
863: <li><cite>Cars</cite>, 2006</li>
864: <li><cite>Toy Story 2</cite>, 1999</li>
865: <li><cite>Finding Nemo</cite>, 2003</li>
866: <li><cite>The Incredibles</cite>, 2004</li>
867: <li><cite>Ratatouille</cite>, 2007</li>
868: </ol>
1.12 mike 869: </figure></pre>
1.264 mike 870: </div><p class="note">If the <code><a href="#the-li-element" id="li-9">li</a></code> element is the child of a
871: <code><a href="interactive-elements.html#menus" id="menu-10">menu</a></code> element and itself has a child that defines a
1.159 mike 872: <a href="commands.html#concept-command" id="concept-command-3" title="concept-command">command</a>, then the
1.264 mike 873: <code><a href="#the-li-element" id="li-10">li</a></code> element will match the <code title="selector-enabled"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/links.html#selector-enabled" title='Read about this ":enabled" reference in the full HTML5 spec.'>:enabled</a></code> and <code title="selector-disabled"><a class="full-spec-link" href="http://dev.w3.org/html5/spec/links.html#selector-disabled" title='Read about this ":disabled" reference in the full HTML5 spec.'>:disabled</a></code> pseudo-classes in the
1.204 mike 874: same way as the first such child element does.<h4 id="the-dl-element"><span class="secno">4.5.8 </span>The <dfn><code>dl</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.205 mike 875: <dd><a href="content-models.html#flow-content" id="flow-content-54">Flow content</a>.</dd>
876: <dt>Contexts in which this element can be used:</dt>
877: <dd>Where <a href="content-models.html#flow-content" id="flow-content-55">flow content</a> is expected.</dd>
1.12 mike 878: <dt>Content model:</dt>
879: <dd>Zero or more groups each consisting of one or more
1.264 mike 880: <code><a href="#the-dt-element" id="dt">dt</a></code> elements followed by one or more <code><a href="#the-dd-element" id="dd">dd</a></code>
1.12 mike 881: elements.</dd>
882: <dt>Content attributes:</dt>
1.159 mike 883: <dd><a href="elements.html#global-attributes" id="global-attributes-26">Global attributes</a></dd>
1.12 mike 884: <dt>DOM interface:</dt>
885: <dd>
1.159 mike 886: <pre class="idl">interface <dfn id="htmldlistelement">HTMLDListElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-33">HTMLElement</a> {};</pre>
1.12 mike 887: </dd>
1.264 mike 888: </dl><p>The <code><a href="#the-dl-element" id="dl-0">dl</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> an
1.12 mike 889: association list consisting of zero or more name-value groups (a
890: description list). Each group must consist of one or more names
1.264 mike 891: (<code><a href="#the-dt-element" id="dt-0">dt</a></code> elements) followed by one or more values
892: (<code><a href="#the-dd-element" id="dd-0">dd</a></code> elements). Within a single <code><a href="#the-dl-element" id="dl-1">dl</a></code> element,
893: there should not be more than one <code><a href="#the-dt-element" id="dt-1">dt</a></code> element for each
1.163 mike 894: name.<p>Name-value groups may be terms and definitions, metadata topics
1.205 mike 895: and values, questions and answers, or any other groups of name-value
896: data.<p>The values within a group are alternatives; multiple paragraphs
1.12 mike 897: forming part of the same value must all be given within the same
1.264 mike 898: <code><a href="#the-dd-element" id="dd-1">dd</a></code> element.<p>The order of the list of groups, and of the names and values
1.163 mike 899: within each group, may be significant.<div class="example">
1.12 mike 900: <p>In the following example, one entry ("Authors") is linked to two
901: values ("John" and "Luke").</p>
902: <pre><dl>
903: <dt> Authors
904: <dd> John
905: <dd> Luke
906: <dt> Editor
907: <dd> Frank
908: </dl></pre>
909: </div><div class="example">
910: <p>In the following example, one definition is linked to two
911: terms.</p>
912: <pre><dl>
913: <dt lang="en-US"> <dfn>color</dfn> </dt>
914: <dt lang="en-GB"> <dfn>colour</dfn> </dt>
915: <dd> A sensation which (in humans) derives from the ability of
916: the fine structure of the eye to distinguish three differently
917: filtered analyses of a view. </dd>
918: </dl></pre>
919: </div><div class="example">
1.264 mike 920: <p>The following example illustrates the use of the <code><a href="#the-dl-element" id="dl-2">dl</a></code>
1.12 mike 921: element to mark up metadata of sorts. At the end of the example,
922: one group has two metadata labels ("Authors" and "Editors") and two
923: values ("Robert Rothman" and "Daniel Jackson").</p>
924: <pre><dl>
925: <dt> Last modified time </dt>
926: <dd> 2004-12-23T23:33Z </dd>
927: <dt> Recommended update interval </dt>
928: <dd> 60s </dd>
929: <dt> Authors </dt>
930: <dt> Editors </dt>
931: <dd> Robert Rothman </dd>
932: <dd> Daniel Jackson </dd>
933: </dl></pre>
934: </div><div class="example">
935:
1.264 mike 936: <p>The following example shows the <code><a href="#the-dl-element" id="dl-3">dl</a></code> element used to
1.12 mike 937: give a set of instructions. The order of the instructions here is
938: important (in the other examples, the order of the blocks was not
939: important).</p>
940:
941: <pre><p>Determine the victory points as follows (use the
942: first matching case):</p>
943: <dl>
944: <dt> If you have exactly five gold coins </dt>
945: <dd> You get five victory points </dd>
946: <dt> If you have one or more gold coins, and you have one or more silver coins </dt>
947: <dd> You get two victory points </dd>
948: <dt> If you have one or more silver coins </dt>
949: <dd> You get one victory point </dd>
950: <dt> Otherwise </dt>
951: <dd> You get no victory points </dd>
952: </dl></pre>
953: </div><div class="example">
1.264 mike 954: <p>The following snippet shows a <code><a href="#the-dl-element" id="dl-4">dl</a></code> element being used
955: as a glossary. Note the use of <code><a href="text-level-semantics.html#the-dfn-element" id="dfn-1">dfn</a></code> to indicate the
1.12 mike 956: word being defined.</p>
957: <pre><dl>
958: <dt><dfn>Apartment</dfn>, n.</dt>
959: <dd>An execution context grouping one or more threads with one or
960: more COM objects.</dd>
961: <dt><dfn>Flat</dfn>, n.</dt>
962: <dd>A deflated tire.</dd>
963: <dt><dfn>Home</dfn>, n.</dt>
964: <dd>The user's login directory.</dd>
965: </dl></pre>
1.264 mike 966: </div><p class="note">The <code><a href="#the-dl-element" id="dl-5">dl</a></code> element is inappropriate for
1.16 mike 967: marking up dialogue. <a href="links.html#conversations">Examples of how to
1.204 mike 968: mark up dialogue</a> are shown below.<h4 id="the-dt-element"><span class="secno">4.5.9 </span>The <dfn><code>dt</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.12 mike 969: <dd>None.</dd>
1.205 mike 970: <dt>Contexts in which this element can be used:</dt>
1.264 mike 971: <dd>Before <code><a href="#the-dd-element" id="dd-2">dd</a></code> or <code><a href="#the-dt-element" id="dt-2">dt</a></code> elements inside <code><a href="#the-dl-element" id="dl-6">dl</a></code> elements.</dd>
1.12 mike 972: <dt>Content model:</dt>
1.205 mike 973: <dd><a href="content-models.html#phrasing-content" id="phrasing-content-23">Phrasing content</a>.</dd>
1.12 mike 974: <dt>Content attributes:</dt>
1.159 mike 975: <dd><a href="elements.html#global-attributes" id="global-attributes-27">Global attributes</a></dd>
1.12 mike 976: <dt>DOM interface:</dt>
1.159 mike 977: <dd>Uses <code><a href="elements.html#htmlelement" id="htmlelement-34">HTMLElement</a></code>.</dd>
1.264 mike 978: </dl><p>The <code><a href="#the-dt-element" id="dt-3">dt</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> the term, or
1.14 mike 979: name, part of a term-description group in a description list
1.264 mike 980: (<code><a href="#the-dl-element" id="dl-7">dl</a></code> element).<p class="note">The <code><a href="#the-dt-element" id="dt-4">dt</a></code> element itself, when used in a
981: <code><a href="#the-dl-element" id="dl-8">dl</a></code> element, does not indicate that its contents are a
1.12 mike 982: term being defined, but this can be indicated using the
1.264 mike 983: <code><a href="text-level-semantics.html#the-dfn-element" id="dfn-2">dfn</a></code> element.<div class="example">
1.23 mike 984:
985: <p>This example shows a list of frequently asked questions (a FAQ)
1.264 mike 986: marked up using the <code><a href="#the-dt-element" id="dt-5">dt</a></code> element for questions and the
987: <code><a href="#the-dd-element" id="dd-3">dd</a></code> element for answers.</p>
1.23 mike 988:
989: <pre><article>
990: <h1>FAQ</h1>
991: <dl>
992: <dt>What do we want?</dt>
993: <dd>Our data.</dd>
994: <dt>When do we want it?</dt>
995: <dd>Now.</dd>
996: <dt>Where is it?</dt>
997: <dd>We are not sure.</dd>
998: </dl>
999: </article></pre>
1000:
1.204 mike 1001: </div><h4 id="the-dd-element"><span class="secno">4.5.10 </span>The <dfn><code>dd</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.12 mike 1002: <dd>None.</dd>
1.205 mike 1003: <dt>Contexts in which this element can be used:</dt>
1.264 mike 1004: <dd>After <code><a href="#the-dt-element" id="dt-6">dt</a></code> or <code><a href="#the-dd-element" id="dd-4">dd</a></code> elements inside <code><a href="#the-dl-element" id="dl-9">dl</a></code> elements.</dd>
1.12 mike 1005: <dt>Content model:</dt>
1.205 mike 1006: <dd><a href="content-models.html#flow-content" id="flow-content-56">Flow content</a>.</dd>
1.12 mike 1007: <dt>Content attributes:</dt>
1.159 mike 1008: <dd><a href="elements.html#global-attributes" id="global-attributes-28">Global attributes</a></dd>
1.12 mike 1009: <dt>DOM interface:</dt>
1.159 mike 1010: <dd>Uses <code><a href="elements.html#htmlelement" id="htmlelement-35">HTMLElement</a></code>.</dd>
1.264 mike 1011: </dl><p>The <code><a href="#the-dd-element" id="dd-5">dd</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> the
1.12 mike 1012: description, definition, or value, part of a term-description group
1.264 mike 1013: in a description list (<code><a href="#the-dl-element" id="dl-10">dl</a></code> element).<div class="example">
1.12 mike 1014:
1.264 mike 1015: <p>A <code><a href="#the-dl-element" id="dl-11">dl</a></code> can be used to define a vocabulary list, like
1.12 mike 1016: in a dictionary. In the following example, each entry, given by a
1.264 mike 1017: <code><a href="#the-dt-element" id="dt-7">dt</a></code> with a <code><a href="text-level-semantics.html#the-dfn-element" id="dfn-3">dfn</a></code>, has several
1018: <code><a href="#the-dd-element" id="dd-6">dd</a></code>s, showing the various parts of the definition.</p>
1.12 mike 1019:
1020: <!-- the actual pronunciations below are nonsense. -->
1021: <pre><dl>
1022: <dt><dfn>happiness</dfn></dt>
1.163 mike 1023: <dd class="pronunciation">/'hæ p. nes/</dd>
1.12 mike 1024: <dd class="part-of-speech"><i><abbr>n.</abbr></i></dd>
1025: <dd>The state of being happy.</dd>
1026: <dd>Good fortune; success. <q>Oh <b>happiness</b>! It worked!</q></dd>
1027: <dt><dfn>rejoice</dfn></dt>
1028: <dd class="pronunciation">/ri jois'/</dd>
1029: <dd><i class="part-of-speech"><abbr>v.intr.</abbr></i> To be delighted oneself.</dd>
1030: <dd><i class="part-of-speech"><abbr>v.tr.</abbr></i> To cause one to be delighted.</dd>
1031: </dl></pre>
1.204 mike 1032: </div><h4 id="the-figure-element"><span class="secno">4.5.11 </span>The <dfn><code>figure</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.205 mike 1033: <dd><a href="content-models.html#flow-content" id="flow-content-57">Flow content</a>.</dd>
1.159 mike 1034: <dd><a href="sections.html#sectioning-root" id="sectioning-root-7">Sectioning root</a>.</dd>
1.205 mike 1035: <dt>Contexts in which this element can be used:</dt>
1036: <dd>Where <a href="content-models.html#flow-content" id="flow-content-58">flow content</a> is expected.</dd>
1.17 mike 1037: <dt>Content model:</dt>
1.264 mike 1038: <dd>Either: One <code><a href="#the-figcaption-element" id="figcaption-0">figcaption</a></code> element followed by <a href="content-models.html#flow-content" id="flow-content-59">flow content</a>.</dd>
1039: <dd>Or: <a href="content-models.html#flow-content" id="flow-content-60">Flow content</a> followed by one <code><a href="#the-figcaption-element" id="figcaption-1">figcaption</a></code> element.</dd>
1.205 mike 1040: <dd>Or: <a href="content-models.html#flow-content" id="flow-content-61">Flow content</a>.</dd>
1.17 mike 1041: <dt>Content attributes:</dt>
1.159 mike 1042: <dd><a href="elements.html#global-attributes" id="global-attributes-29">Global attributes</a></dd>
1.17 mike 1043: <dt>DOM interface:</dt>
1.159 mike 1044: <dd>Uses <code><a href="elements.html#htmlelement" id="htmlelement-36">HTMLElement</a></code>.</dd>
1.264 mike 1045: </dl><!-- v2: Add a <credit> element for photo credits --><p>The <code><a href="#the-figure-element" id="figure-2">figure</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> some
1.205 mike 1046: <a href="content-models.html#flow-content" id="flow-content-62">flow content</a>, optionally with a caption, that is
1.17 mike 1047: self-contained and is typically referenced as a single unit from the
1.163 mike 1048: main flow of the document.<p>The element can thus be used to annotate illustrations, diagrams,
1.17 mike 1049: photos, code listings, etc, that are referred to from the main
1050: content of the document, but that could, without affecting the flow
1051: of the document, be moved away from that primary content, e.g. to
1.264 mike 1052: the side of the page, to dedicated pages, or to an appendix.<p>The <code><a href="#the-figcaption-element" id="figcaption-2">figcaption</a></code>
1.17 mike 1053: element child of the element, if any, represents the caption of the
1.264 mike 1054: <code><a href="#the-figure-element" id="figure-3">figure</a></code> element's contents. If there is no child
1055: <code><a href="#the-figcaption-element" id="figcaption-3">figcaption</a></code> element, then there is no caption.<div class="example">
1.17 mike 1056:
1.264 mike 1057: <p>This example shows the <code><a href="#the-figure-element" id="figure-4">figure</a></code> element to mark up a
1.17 mike 1058: code listing.</p>
1059:
1060: <pre><p>In <a href="#l4">listing 4</a> we see the primary core interface
1061: API declaration.</p>
1062: <figure id="l4">
1063: <figcaption>Listing 4. The primary core interface API declaration.</figcaption>
1064: <pre><code>interface PrimaryCore {
1065: boolean verifyDataLine();
1066: void sendData(in sequence&lt;byte> data);
1067: void initSelfDestruct();
1068: }</code></pre>
1069: </figure>
1070: <p>The API is designed to use UTF-8.</p></pre>
1071:
1072: </div><div class="example">
1073:
1.264 mike 1074: <p>Here we see a <code><a href="#the-figure-element" id="figure-5">figure</a></code> element to mark up a
1.17 mike 1075: photo.</p>
1076:
1077: <pre><figure>
1078: <img src="bubbles-work.jpeg"
1079: alt="Bubbles, sitting in his office chair, works on his
1080: latest project intently.">
1081: <figcaption>Bubbles at work</figcaption>
1082: </figure></pre>
1083:
1084: </div><div class="example">
1085:
1086: <p>In this example, we see an image that is <em>not</em>
1087: a figure, as well as an image and a video that are.</p>
1088:
1089: <pre><h2>Malinko's comics</h2>
1090:
1091: <p>This case centered on some sort of "intellectual property"
1092: infringement related to a comic (see Exhibit A). The suit started
1093: after a trailer ending with these words:
1094:
1095: <blockquote>
1096: <img src="promblem-packed-action.png" alt="ROUGH COPY! Promblem-Packed Action!">
1097: </blockquote>
1098:
1099: <p>...was aired. A lawyer, armed with a Bigger Notebook, launched a
1100: preemptive strike using snowballs. A complete copy of the trailer is
1101: included with Exhibit B.
1102:
1103: <figure>
1104: <img src="ex-a.png" alt="Two squiggles on a dirty piece of paper.">
1105: <figcaption>Exhibit A. The alleged <cite>rough copy</cite> comic.</figcaption>
1106: </figure>
1107:
1108: <figure>
1109: <video src="ex-b.mov"></video>
1110: <figcaption>Exhibit B. The <cite>Rough Copy</cite> trailer.</figcaption>
1111: </figure>
1112:
1113: <p>The case was resolved out of court.</pre>
1114:
1115: </div><div class="example">
1116:
1117: <p>Here, a part of a poem is marked up using
1.264 mike 1118: <code><a href="#the-figure-element" id="figure-6">figure</a></code>.</p>
1.17 mike 1119:
1120: <pre><figure>
1121: <p>'Twas brillig, and the slithy toves<br>
1122: Did gyre and gimble in the wabe;<br>
1123: All mimsy were the borogoves,<br>
1124: And the mome raths outgrabe.</p>
1125: <figcaption><cite>Jabberwocky</cite> (first verse). Lewis Carroll, 1832-98</figcaption>
1126: </figure></pre>
1127:
1128: </div><div class="example">
1129:
1130: <p>In this example, which could be part of a much larger work
1131: discussing a castle, the figure has three images in it.</p>
1132:
1133: <pre><figure>
1134: <img src="castle1423.jpeg" title="Etching. Anonymous, ca. 1423."
1135: alt="The castle has one tower, and a tall wall around it.">
1136: <img src="castle1858.jpeg" title="Oil-based paint on canvas. Maria Towle, 1858."
1137: alt="The castle now has two towers and two walls.">
1138: <img src="castle1999.jpeg" title="Film photograph. Peter Jankle, 1999."
1139: alt="The castle lies in ruins, the original tower all that remains in one piece.">
1140: <figcaption>The castle through the ages: 1423, 1858, and 1999 respectively.</figcaption>
1141: </figure></pre>
1142:
1.27 mike 1143: </div><h4 id="the-figcaption-element"><span class="secno">4.5.12 </span>The <dfn><code>figcaption</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.17 mike 1144: <dd>None.</dd>
1.205 mike 1145: <dt>Contexts in which this element can be used:</dt>
1.264 mike 1146: <dd>As the first or last child of a <code><a href="#the-figure-element" id="figure-7">figure</a></code> element.</dd>
1.17 mike 1147: <dt>Content model:</dt>
1.205 mike 1148: <dd><a href="content-models.html#flow-content" id="flow-content-63">Flow content</a>.</dd>
1.17 mike 1149: <dt>Content attributes:</dt>
1.159 mike 1150: <dd><a href="elements.html#global-attributes" id="global-attributes-30">Global attributes</a></dd>
1.17 mike 1151: <dt>DOM interface:</dt>
1.159 mike 1152: <dd>Uses <code><a href="elements.html#htmlelement" id="htmlelement-37">HTMLElement</a></code>.</dd>
1.264 mike 1153: </dl><p>The <code><a href="#the-figcaption-element" id="figcaption-4">figcaption</a></code> element <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a
1.17 mike 1154: caption or legend for the rest of the contents of the
1.264 mike 1155: <code><a href="#the-figcaption-element" id="figcaption-5">figcaption</a></code> element's parent <code><a href="#the-figure-element" id="figure-8">figure</a></code>
1.204 mike 1156: element.<h4 id="the-div-element"><span class="secno">4.5.13 </span>The <dfn><code>div</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
1.205 mike 1157: <dd><a href="content-models.html#flow-content" id="flow-content-64">Flow content</a>.</dd>
1.159 mike 1158: <dd><a href="dnd.html#formatblock-candidate" id="formatblock-candidate-12"><code title="">formatBlock</code> candidate</a>.</dd>
1.205 mike 1159: <dt>Contexts in which this element can be used:</dt>
1160: <dd>Where <a href="content-models.html#flow-content" id="flow-content-65">flow content</a> is expected.</dd>
1.12 mike 1161: <dt>Content model:</dt>
1.205 mike 1162: <dd><a href="content-models.html#flow-content" id="flow-content-66">Flow content</a>.</dd>
1.12 mike 1163: <dt>Content attributes:</dt>
1.159 mike 1164: <dd><a href="elements.html#global-attributes" id="global-attributes-31">Global attributes</a></dd>
1.12 mike 1165: <dt>DOM interface:</dt>
1166: <dd>
1.159 mike 1167: <pre class="idl">interface <dfn id="htmldivelement">HTMLDivElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement-38">HTMLElement</a> {};</pre>
1.12 mike 1168: </dd>
1.264 mike 1169: </dl><p>The <code><a href="#the-div-element" id="div-8">div</a></code> element has no special meaning at all. It
1.165 mike 1170: <a class="full-spec-link" href="http://dev.w3.org/html5/spec/rendering.html#represents" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> its children. It can be used with the <code title="attr-class"><a href="elements.html#classes" id="class-4">class</a></code>, <code title="attr-lang"><a href="elements.html#attr-lang" id="lang-7">lang</a></code>, and <code title="attr-title"><a href="elements.html#the-title-attribute" id="title-9">title</a></code> attributes to mark up semantics
1.163 mike 1171: common to a group of consecutive elements.<p class="note">Authors are strongly encouraged to view the
1.264 mike 1172: <code><a href="#the-div-element" id="div-9">div</a></code> element as an element of last resort, for when no
1173: other element is suitable. Use of the <code><a href="#the-div-element" id="div-10">div</a></code> element
1.12 mike 1174: instead of more appropriate elements leads to poor accessibility for
1.163 mike 1175: readers and poor maintainability for authors.<div class="example">
1.12 mike 1176:
1177: <p>For example, a blog post would be marked up using
1.159 mike 1178: <code><a href="sections.html#the-article-element" id="article-15">article</a></code>, a chapter using <code><a href="sections.html#the-section-element" id="section-12">section</a></code>, a
1179: page's navigation aids using <code><a href="sections.html#the-nav-element" id="nav-8">nav</a></code>, and a group of form
1.264 mike 1180: controls using <code><a href="forms.html#the-fieldset-element" id="fieldset-3">fieldset</a></code>.</p>
1.12 mike 1181:
1.264 mike 1182: <p>On the other hand, <code><a href="#the-div-element" id="div-11">div</a></code> elements can be useful for
1.12 mike 1183: stylistic purposes or to wrap multiple paragraphs within a section
1184: that are all to be annotated in a similar way. In the following
1.264 mike 1185: example, we see <code><a href="#the-div-element" id="div-12">div</a></code> elements used as a way to set the
1.12 mike 1186: language of two paragraphs at once, instead of setting the language
1187: on the two paragraph elements separately:</p>
1188:
1189: <pre><article lang="en-US">
1190: <h1>My use of language and my cats</h1>
1191: <p>My cat's behavior hasn't changed much since her absence, except
1192: that she plays her new physique to the neighbors regularly, in an
1193: attempt to get pets.</p>
1194: <div lang="en-GB">
1195: <p>My other cat, coloured black and white, is a sweetie. He followed
1196: us to the pool today, walking down the pavement with us. Yesterday
1197: he apparently visited our neighbours. I wonder if he recognises that
1198: their flat is a mirror image of ours.</p>
1199: <p>Hm, I just noticed that in the last paragraph I used British
1200: English. But I'm supposed to write in American English. So I
1201: shouldn't say "pavement" or "flat" or "colour"...</p>
1202: </div>
1203: <p>I should say "sidewalk" and "apartment" and "color"!</p>
1204: </article></pre>
1205:
1.163 mike 1206: </div>
Webmaster