This repository has been archived by the owner on Jan 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
syntax.html
1266 lines (1256 loc) · 62.2 KB
/
syntax.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html id="syntax">
<head>
<meta charset=utf-8>
<link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-WD" type="text/css">
<title>HTML syntax - HTML5</title>
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="prev" href="documents.html" title="documents">
<link rel="next" href="elements-by-function.html" title="elements by function">
<link rel="section" href="Overview.html">
<link rel="contents" href="Overview.html#toc">
<link rel="index" href="index-of-terms.html">
</head>
<body class="chunk" onload="initDfn()">
<div id="jump-indexes" class="no-number no-toc"><div id="jumpIndexA-button" role="button" aria-haspopup="true" tabindex="0">jump</div></div>
<h2 class="chunkpagetitle"><a href="Overview.html#toc">HTML: The Markup Language (an HTML language reference)</a></h2>
<div class="nav">
<span class="nav-prev"><a href="documents.html">« documents</a></span>
<span class="nav-next"><a href="elements-by-function.html">elements by function »</a></span>
</div>
<div class="section">
<h2>4. HTML syntax <a class="hash" href="#syntax">#</a> <a class="toc-bak" href="Overview.html#syntax-toc">T</a>
</h2>
<p>This section describes
<a href="documents.html#html-syntax" id="html-syntax_xref4">the HTML syntax</a>
in detail. In places, it also notes differences between the
<a href="documents.html#html-syntax" id="html-syntax_xref5">the HTML syntax</a>
and
<a href="documents.html#xml-syntax" id="xml-syntax_xref3">the XML syntax</a>,
but it does not describe the XML syntax in detail (the XML
syntax is instead defined by rules in the
<a href="references.html#refsXML" id="refsXML_xref2">[XML]</a>
specification and in the
<a href="references.html#refsNamespacesInXML" id="refsNamespacesInXML_xref3">[Namespaces in XML]</a>
specification).</p>
<p>This section is divided into the following parts:</p>
<div class="toc">
<ul>
<li> <a href="syntax.html#doctype-syntax"><span class="toc-section-number">1. </span><span class="toc-section-name"> The doctype</span></a>
</li>
<li> <a href="syntax.html#character-encoding"><span class="toc-section-number">2. </span><span class="toc-section-name"> Character encoding declaration</span></a>
</li>
<li> <a href="syntax.html#syntax-elements"><span class="toc-section-number">3. </span><span class="toc-section-name"> Elements</span></a>
</li>
<li> <a href="syntax.html#syntax-attributes"><span class="toc-section-number">4. </span><span class="toc-section-name"> Attributes</span></a>
</li>
<li> <a href="syntax.html#text-syntax"><span class="toc-section-number">5. </span><span class="toc-section-name"> Text and character data</span></a>
</li>
<li> <a href="syntax.html#character-references"><span class="toc-section-number">6. </span><span class="toc-section-name"> Character references</span></a>
</li>
<li> <a href="syntax.html#comments"><span class="toc-section-number">7. </span><span class="toc-section-name"> Comments</span></a>
</li>
<li> <a href="syntax.html#svg-mathml"><span class="toc-section-number">8. </span><span class="toc-section-name"> SVG and MathML elements in HTML documents</span></a>
</li>
<li> <a href="syntax.html#cdata-sections"><span class="toc-section-number">9. </span><span class="toc-section-name"> CDATA sections in SVG and MathML contents</span></a>
</li>
</ul>
</div>
<div id="doctype-syntax" class="section">
<h2>4.1. The doctype <a class="hash" href="#doctype-syntax">#</a> <a class="toc-bak" href="Overview.html#doctype-syntax-toc">T</a>
</h2>
<p>A
<dfn id="doctype" role="button" tabindex="0" aria-haspopup="true">doctype</dfn>
(sometimes capitalized as “DOCTYPE”) is an special instruction
which, for legacy reasons that have to do with processing
modes in browsers, is a required part of any
<a href="documents.html#syntax-document-html" id="syntax-document-html_xref7">document in the HTML syntax</a>;
it
<a href="terminology.html#must-requirement" id="must-requirement_xref12">must</a>
match the characteristics of one of the following three formats:</p>
<ul>
<li><a href="syntax.html#normal-doctype" id="normal-doctype_xref1">normal doctype</a></li>
<li><a href="syntax.html#deprecated-doctype" id="deprecated-doctype_xref1">deprecated doctype</a></li>
<li><a href="syntax.html#legacy-tool-compatible-doctype" id="legacy-tool-compatible-doctype_xref1">legacy-tool-compatible doctype</a></li>
</ul>
<p>A
<dfn id="normal-doctype" role="button" tabindex="0" aria-haspopup="true">normal doctype</dfn>
consists of the following parts, in exactly the following
order:</p>
<ol>
<li>Any
<a href="terminology.html#case-insensitive" id="case-insensitive_xref3">case-insensitive match</a>
for the string
"<code><!DOCTYPE</code>".</li>
<li>One or more
<a href="terminology.html#space" id="space_xref4">space characters</a>.</li>
<li>Any
<a href="terminology.html#case-insensitive" id="case-insensitive_xref4">case-insensitive match</a>
for the string
"<code>HTML</code>".</li>
<li>Optionally, one or more
<a href="terminology.html#space" id="space_xref5">space characters</a>.</li>
<li>A
"<code title="U+003E GREATER-THAN SIGN">></code>"
character.</li>
</ol>
<div class="example">
<p>The following is an example of a conformant
<a href="syntax.html#normal-doctype" id="normal-doctype_xref2">normal doctype</a>.</p>
<pre><!DOCTYPE html></pre>
</div>
<p>A
<dfn id="deprecated-doctype" role="button" tabindex="0" aria-haspopup="true">deprecated doctype</dfn>
consists of the following parts, in exactly the following order:</p>
<ol>
<li>Any
<a href="terminology.html#case-insensitive" id="case-insensitive_xref5">case-insensitive match</a>
for the string
"<code><!DOCTYPE</code>".</li>
<li>One or more
<a href="terminology.html#space" id="space_xref6">space characters</a>.</li>
<li>Any
<a href="terminology.html#case-insensitive" id="case-insensitive_xref6">case-insensitive match</a>
for the string
"<code>HTML</code>".</li>
<li>One or more
<a href="terminology.html#space" id="space_xref7">space characters</a>.</li>
<li>Any
<a href="terminology.html#case-insensitive" id="case-insensitive_xref7">case-insensitive match</a>
for the string
"<code>PUBLIC</code>".</li>
<li>One or more
<a href="terminology.html#space" id="space_xref8">space characters</a>.</li>
<li>A <i>quote mark (public ID)</i>, consisting of either a
"<code title="U+0022 QUOTATION MARK">"</code>"
character or a
"<code title="U+0027 APOSTROPHE">'</code>"
character.</li>
<li>A
<a href="syntax.html#permitted-public-ID" id="permitted-public-ID_xref1">permitted public ID</a>
</li>
<li>A matching <i>quote mark (public ID)</i>, identical to the
<i>quote mark (public ID)</i> used earlier (either a
"<code title="U+0022 QUOTATION MARK">"</code>"
character or a
"<code title="U+0027 APOSTROPHE">'</code>"
character).</li>
<li>Conditionally, depending on whether it is part of a
<a href="syntax.html#permitted-public-ID-system-ID-combination" id="permitted-public-ID-system-ID-combination_xref1">permitted-public-ID-system-ID-combination</a>,
the following parts, in exactly the following order:
<ol>
<li>One or more
<a href="terminology.html#space" id="space_xref9">space characters</a>.</li>
<li>A <i>quote mark (system ID)</i>, consisting of either a
"<code title="U+0022 QUOTATION MARK">"</code>"
character or a
"<code title="U+0027 APOSTROPHE">'</code>"
character.</li>
<li>A
<a href="syntax.html#permitted-system-ID" id="permitted-system-ID_xref1">permitted system ID</a>
</li>
<li>A matching <i>quote mark (system ID)</i>, identical to the
<i>quote mark (system ID)</i> used earlier (either a
"<code title="U+0022 QUOTATION MARK">"</code>"
character or a
"<code title="U+0027 APOSTROPHE">'</code>"
character).</li>
</ol>
</li>
<li>Optionally, one or more
<a href="terminology.html#space" id="space_xref10">space characters</a>.</li>
<li>A
"<code title="U+003E GREATER-THAN SIGN">></code>"
character.</li>
</ol>
<p>A
<dfn id="permitted-public-ID-system-ID-combination" role="button" tabindex="0" aria-haspopup="true">permitted-public-ID-system-ID-combination</dfn>
is any combination of a
<dfn id="permitted-public-ID" role="button" tabindex="0" aria-haspopup="true">public ID</dfn>
(the first quoted string in the doctype)
and
<dfn id="permitted-system-ID" role="button" tabindex="0" aria-haspopup="true">system ID</dfn>
(the second quoted string, if any, in the doctype)
such that the combination corresponds to one of the six
<a href="syntax.html#deprecated-doctype" id="deprecated-doctype_xref2">deprecated doctypes</a>
in the following
<a id="list-of-deprecated-doctypes" href="syntax.html#list-of-deprecated-doctypes">list of deprecated doctypes</a>:</p>
<div class="example">
<pre><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"></pre>
</div>
<p>A
<dfn id="legacy-tool-compatible-doctype" role="button" tabindex="0" aria-haspopup="true">legacy-tool-compatible doctype</dfn>
consists of the following parts, in exactly the following order:</p>
<ol>
<li>Any
<a href="terminology.html#case-insensitive" id="case-insensitive_xref8">case-insensitive match</a>
for the string
"<code><!DOCTYPE</code>".</li>
<li>One or more
<a href="terminology.html#space" id="space_xref11">space characters</a>.</li>
<li>Any
<a href="terminology.html#case-insensitive" id="case-insensitive_xref9">case-insensitive match</a>
for the string
"<code>HTML</code>".</li>
<li>One or more
<a href="terminology.html#space" id="space_xref12">space characters</a>.</li>
<li>Any
<a href="terminology.html#case-insensitive" id="case-insensitive_xref10">case-insensitive match</a>
for the string
"<code>SYSTEM</code>".</li>
<li>One or more
<a href="terminology.html#space" id="space_xref13">space characters</a>
</li>
<li>A <i>quote mark</i>, consisting of either
a
"<code title="U+0022 QUOTATION MARK">"</code>"
character or a
"<code title="U+0027 APOSTROPHE">'</code>"
character.</li>
<li>The literal string
"<code>about:legacy-compat</code>".</li>
<li>A matching <i>quote mark</i>, identical to the
<i>quote mark</i> used earlier (either a
"<code title="U+0022 QUOTATION MARK">"</code>"
character or a
"<code title="U+0027 APOSTROPHE">'</code>"
character).</li>
<li>Optionally, one or more
<a href="terminology.html#space" id="space_xref14">space characters</a>.</li>
<li>A
"<code title="U+003E GREATER-THAN SIGN">></code>"
character.</li>
</ol>
<div class="example">
<p>The following is examples of a conformant
<a href="syntax.html#legacy-tool-compatible-doctype" id="legacy-tool-compatible-doctype_xref2">legacy-tool-compatible doctype</a>.</p>
<pre><!doctype HTML system "about:legacy-compat"></pre>
</div>
</div>
<div id="character-encoding" class="section">
<h2>4.2. Character encoding declaration <a class="hash" href="#character-encoding">#</a> <a class="toc-bak" href="Overview.html#character-encoding-toc">T</a>
</h2>
<p>A
<dfn id="encoding-declaration" title="encoding-declaration" role="button" tabindex="0" aria-haspopup="true">character encoding declaration</dfn>
is a mechanism for specifying the character encoding used to store
or transmit a document.</p>
<p>The following restrictions apply to character encoding
declarations:</p>
<ul>
<li>The character encoding name given
<a href="terminology.html#must-requirement" id="must-requirement_xref13">must</a>
be the name of
the character encoding used to serialize the file.</li>
<li>The value
<a href="terminology.html#must-requirement" id="must-requirement_xref14">must</a>
be a valid character encoding name, and
<a href="terminology.html#must-requirement" id="must-requirement_xref15">must</a>
be a
<a href="terminology.html#case-insensitive" id="case-insensitive_xref11">case-insensitive match</a>
for a
<var class="defined-elsewhere">character set name</var>
for which the IANA
<a href="references.html#refsCharacterSets" id="refsCharacterSets_xref1">[Character Sets]</a>
registry has a <code>Name</code> or <code>Alias</code> field
labeled as “preferred MIME name”;
or, if none of the <code>Alias</code> fields are so labeled, a
<a href="terminology.html#case-insensitive" id="case-insensitive_xref12">case-insensitive match</a>
for a <code>Name</code> field in the registry.</li>
<li>The character encoding declaration
<a href="terminology.html#must-requirement" id="must-requirement_xref16">must</a>
be serialized
without the use of
<a href="syntax.html#syntax-charref" id="syntax-charref_xref1">character references</a>
or character escapes of any kind.</li>
<li>The element containing the character encoding
declaration
<a href="terminology.html#must-requirement" id="must-requirement_xref17">must</a>
be serialized completely within the first
512 bytes of the document.</li>
</ul>
<p>If the document does not start with a
U+FEFF BYTE ORDER MARK (BOM) character, and if its
encoding is not explicitly given by a
<code>Content-Type</code> HTTP header, then the character
encoding used
<a href="terminology.html#must-requirement" id="must-requirement_xref18">must</a>
be an
<a href="syntax.html#ascii-compatible" id="ascii-compatible_xref1">ASCII-compatible character encoding</a>,
and, in addition, if that encoding isn't US-ASCII itself, then
the encoding
<a href="terminology.html#must-requirement" id="must-requirement_xref19">must</a>
be specified using a
<code><a href="meta.html#meta">meta</a></code> element with a
<a href="meta.charset.html#meta.charset.attrs.charset">charset</a>
attribute or a <code><a href="meta.html#meta">meta</a></code> element
in the
<a href="meta.http-equiv.content-type.html#encoding-declaration-state" id="encoding-declaration-state_xref1">encoding declaration
state</a>.</p>
<p>If the document contains a <code><a href="meta.html#meta">meta</a></code>
element with a
<a href="meta.charset.html#meta.charset.attrs.charset">charset</a>
attribute or a <code><a href="meta.html#meta">meta</a></code> element in the
<a href="meta.http-equiv.content-type.html#encoding-declaration-state" id="encoding-declaration-state_xref2">encoding declaration state</a>,
then the character encoding used
<a href="terminology.html#must-requirement" id="must-requirement_xref20">must</a>
be an
<a href="syntax.html#ascii-compatible" id="ascii-compatible_xref2">ASCII-compatible character encoding</a>.</p>
<p>An
<dfn id="ascii-compatible" role="button" tabindex="0" aria-haspopup="true">ASCII-compatible character encoding</dfn>
is one that is a superset of US-ASCII (specifically,
ANSI_X3.4-1968) for bytes in the set 0x09, 0x0A, 0x0C, 0x0D,
0x20 - 0x22, 0x26, 0x27, 0x2C - 0x3F, 0x41 - 0x5A, and 0x61 -
0x7A.</p>
<p>
Documents should not use
UTF-32,
JIS_C6226-1983,
JIS_X0212-1990,
HZ-GB-2312,
JOHAB (Windows code page 1361),
encodings based on ISO-2022,
or encodings based on EBCDIC.</p>
<p>Documents
<a href="terminology.html#must-requirement" id="must-requirement_xref21">must</a>
not use
CESU-8,
UTF-7,
BOCU-1,
or SCSU
encodings.</p>
<p>In a
<a href="documents.html#syntax-document-xml" id="syntax-document-xml_xref6">document in the XML syntax</a>,
the
<dfn id="xml-declaration" title="xml-declaration" role="button" tabindex="0" aria-haspopup="true">XML declaration</dfn>,
as defined in the XML specification
<a href="references.html#refsXML" id="refsXML_xref3">[XML]</a>
should be used to provide character-encoding information, if
necessary.</p>
</div>
<div id="syntax-elements" class="section">
<h2>4.3. Elements <a class="hash" href="#syntax-elements">#</a> <a class="toc-bak" href="Overview.html#syntax-elements-toc">T</a>
</h2>
<p>An element’s
<dfn id="content-model" title="content-model" role="button" tabindex="0" aria-haspopup="true">content model</dfn>
defines the element’s structure: What
<a href="syntax.html#contents" id="contents_xref2">contents</a> (if any) the element can
contain, as well as what attributes (if any) the element can
have. The
<a href="elements.html">HTML elements</a>
section of this reference describes the content models for
all of elements that are part of the
<a href="documents.html#html-language" id="html-language_xref4">HTML language</a>.
An element
<a href="terminology.html#must-requirement" id="must-requirement_xref22">must</a>
not contain
<a href="syntax.html#contents" id="contents_xref3">contents</a>
or attributes that are not part of its content model.</p>
<p>The
<dfn id="contents" title="contents" role="button" tabindex="0" aria-haspopup="true">contents</dfn>
of an element are any
<a href="syntax.html#syntax-elements">elements</a>,
<a href="syntax.html#character-data" id="character-data_xref1">character data</a>,
and
<a href="syntax.html#syntax-comments" id="syntax-comments_xref4">comments</a>
that it contains.
Attributes and their values are not considered to be the
“contents” of an element.</p>
<p>The
<dfn id="text-content" title="text-content" role="button" tabindex="0" aria-haspopup="true">text content</dfn>
of an element is the value of the <code>textContent</code> IDL
attribute of the element, as defined in
<a href="references.html#refsDOM" id="refsDOM_xref2">[DOM4]</a>.</p>
<p>A
<dfn id="void-element" title="void-element" role="button" tabindex="0" aria-haspopup="true">void element</dfn>
is an element whose
<a href="syntax.html#content-model" id="content-model_xref1">content model</a>
never allows it to have
<a href="syntax.html#contents" id="contents_xref4">contents</a>
under any circumstances.
Void elements can have attributes.</p>
<p>The following is a complete list of the
<dfn id="void-elements" role="button" tabindex="0" aria-haspopup="true">void elements in HTML</dfn>:</p>
<ul>
<li>
<code><a href="area.html#area">area</a></code>,
<code><a href="base.html#base">base</a></code>,
<code><a href="br.html#br">br</a></code>,
<code><a href="col.html#col">col</a></code>,
<code><a href="command.html#command">command</a></code>,
<code><a href="embed.html#embed">embed</a></code>,
<code><a href="hr.html#hr">hr</a></code>,
<code><a href="img.html#img">img</a></code>,
<code><a href="input.html#input">input</a></code>,
<code><a href="keygen.html#keygen">keygen</a></code>,
<code><a href="link.html#link">link</a></code>,
<code><a href="meta.html#meta">meta</a></code>,
<code><a href="param.html#param">param</a></code>,
<code><a href="source.html#source">source</a></code>,
<code><a href="track.html#track">track</a></code>,
<code><a href="wbr.html#wbr">wbr</a></code>
</li>
</ul>
<p id="elements-html-syntax">The following list describes syntax
rules for the
<a href="documents.html#html-syntax" id="html-syntax_xref6">the HTML syntax</a>.
Rules for the
<a href="documents.html#xml-syntax" id="xml-syntax_xref4">the XML syntax</a>
are defined in the XML specification
<a href="references.html#refsXML" id="refsXML_xref4">[XML]</a>.</p>
<ul id="elements-html-syntax-list">
<li>
<dfn id="tags" title="syntax-tags" role="button" tabindex="0" aria-haspopup="true">tags</dfn> are used to
delimit the start and end of elements in markup. Elements
have a
<a href="syntax.html#syntax-start-tags" id="syntax-start-tags_xref3">start tag</a>
to indicate where they begin. Non-<a href="syntax.html#void-element" id="void-element_xref1">void</a> elements have an
<a href="syntax.html#syntax-end-tags" id="syntax-end-tags_xref3">end tag</a>
to
indicate where they end.</li>
<li>
<dfn id="tag-name" title="syntax-tag-name" role="button" tabindex="0" aria-haspopup="true">tag names</dfn>
are used within element start tags and end tags to
give the element’s name.
<a href="elements.html#html-elements">HTML elements</a>
all have names that only use characters in the range
<code title="U+0030 DIGIT ZERO–U+0039 DIGIT NINE">0–9</code>,
<code title="U+0061 LATIN SMALL LETTER A–U+007A LATIN SMALL LETTER Z">a–z</code>,
and
<code title="U+0041 LATIN CAPITAL LETTER A–U+005A LATIN CAPITAL LETTER Z">A–Z</code>.</li>
<li>
<dfn id="syntax-start-tags" role="button" tabindex="0" aria-haspopup="true">start tags</dfn>
consist of the following parts, in exactly the following
order:
<ol>
<li>A
"<code title="U+003C LESS-THAN SIGN"><</code>"
character.</li>
<li>The element’s
<a href="syntax.html#tag-name" title="syntax-tag-name" id="tag-name_xref3">tag name</a>.</li>
<li>Optionally, one or more
<a href="syntax.html#attribute" id="attribute_xref2">attributes</a>,
each of which
<a href="terminology.html#must-requirement" id="must-requirement_xref23">must</a>
be preceded by one or more
<a href="terminology.html#space" id="space_xref15">space characters</a>.</li>
<li>Optionally, one or more
<a href="terminology.html#space" id="space_xref16">space characters</a>.</li>
<li>Optionally, a
"<code title="U+002F SOLIDUS">/</code>"
character, which may be present only if the element is a
<a href="syntax.html#void-element" id="void-element_xref2">void element</a>.</li>
<li>A
"<code title="U+003E GREATER-THAN SIGN">></code>"
character.</li>
</ol>
</li>
<li>
<dfn id="syntax-end-tags" role="button" tabindex="0" aria-haspopup="true">end tags</dfn>
consist of the following parts, in exactly the following
order:
<ol>
<li>A
"<code title="U+003C LESS-THAN SIGN"><</code>"
character.</li>
<li>A
"<code title="U+002F SOLIDUS">/</code>"
character</li>
<li>The element’s
<a href="syntax.html#tag-name" title="syntax-tag-name" id="tag-name_xref4">tag name</a>.</li>
<li>Optionally, one or more
<a href="terminology.html#space" title="space character" id="space_xref17">space characters</a>.</li>
<li>A
"<code title="U+003E GREATER-THAN SIGN">></code>"
character.</li>
</ol>
</li>
<li>
<a href="syntax.html#void-element" id="void-element_xref3">Void elements</a> only have a
start tag; end tags
<a href="terminology.html#must-requirement" id="must-requirement_xref24">must</a>
not be specified for void
elements.</li>
<li>The start and end tags of certain elements can be <dfn id="omitted" title="syntax-tag-omission" role="button" tabindex="0" aria-haspopup="true">omitted</dfn>.
The subsection for each element in the <a href="elements.html">HTML elements</a> section of this
reference provides information about which tags (if any)
can be omitted for that particular element.</li>
<li>A non-<a href="syntax.html#void-element" id="void-element_xref4">void</a> element
<a href="terminology.html#must-requirement" id="must-requirement_xref25">must</a>
have
an end tag, unless the subsection for that element in the <a href="elements.html">HTML elements</a> section of this
reference indicates that its end tag can be <a href="syntax.html#omitted" id="omitted_xref4">omitted</a>.</li>
<li>The <a href="syntax.html#contents" id="contents_xref5">contents</a> of an element
<a href="terminology.html#must-requirement" id="must-requirement_xref26">must</a>
be
placed between just after its start tag (which
<a href="syntax.html#omitted" title="syntax-tag-omission" id="omitted_xref5">might be
implied, in certain cases</a>) and just before its end tag
(which <a href="syntax.html#omitted" title="syntax-tag-omission" id="omitted_xref6">might be
implied in certain cases</a>).</li>
</ul>
<div id="misnesting" class="no-toc section">
<h2>4.3.1. Misnested tags <a class="hash" href="#misnesting">#</a>
</h2>
<p>If an
<a href="syntax.html#syntax-elements">element</a>
has both a
<a href="syntax.html#syntax-start-tags" id="syntax-start-tags_xref4">start tag</a>
and an
<a href="syntax.html#syntax-end-tags" id="syntax-end-tags_xref4">end tag</a>,
its end tag
<a href="terminology.html#must-requirement" id="must-requirement_xref27">must</a>
be contained within the
<a href="syntax.html#contents" id="contents_xref6">contents</a>
of the same element in which its start tag is contained.
An
<a href="syntax.html#syntax-end-tags" id="syntax-end-tags_xref5">end tag</a>
that is not contained within the same
<a href="syntax.html#contents" id="contents_xref7">contents</a>
as its
<a href="syntax.html#syntax-start-tags" id="syntax-start-tags_xref5">start tag</a>
is said to be a
<dfn id="misnested-tag" title="misnested-tag" role="button" tabindex="0" aria-haspopup="true">misnested tag</dfn>.</p>
<div class="example">
<p>In the following example, the
"<code></i></code>"
<a href="syntax.html#syntax-end-tags" id="syntax-end-tags_xref6">end tag</a>
is a
<a href="syntax.html#misnested-tag" id="misnested-tag_xref1">misnested tag</a>,
because it is not contained
within the
<a href="syntax.html#contents" id="contents_xref8">contents</a>
of the
<span class="element">b</span>
element that contains its corresponding
"<code><i></code>"
start tag.</p>
<pre><b>foo <i>bar</b> baz</i></pre>
</div>
</div>
</div>
<div id="syntax-attributes" class="section">
<h2>4.4. Attributes <a class="hash" href="#syntax-attributes">#</a> <a class="toc-bak" href="Overview.html#syntax-attributes-toc">T</a>
</h2>
<p>
<dfn id="attribute" title="syntax-attributes" role="button" tabindex="0" aria-haspopup="true">attributes</dfn>
for an element are expressed inside the element’s start
tag. Attributes have a
<a href="syntax.html#attribute-name" id="attribute-name_xref3">name</a>
and a
<a href="syntax.html#syntax-attribute-value" id="syntax-attribute-value_xref1">value</a>.</p>
<p>There
<a href="terminology.html#must-requirement" id="must-requirement_xref28">must</a>
never be two or more attributes on the same
start tag whose names are a
<a href="terminology.html#case-insensitive" id="case-insensitive_xref13">case-insensitive match</a>
for each other.</p>
<p id="attributes-basic-syntax">The following list describes syntax
rules for attributes in
<a href="documents.html#syntax-document-html" id="syntax-document-html_xref8">documents in the HTML syntax</a>.
Syntax rules for attributes in
<a href="documents.html#syntax-document-xml" id="syntax-document-xml_xref7">documents in the XML syntax</a>.
are defined in
the XML specification <a href="references.html#refsXML" id="refsXML_xref5">[XML]</a>.
</p>
<ul id="attributes-basic-syntax-list">
<li>
<dfn id="attribute-name" title="syntax-attribute-name" role="button" tabindex="0" aria-haspopup="true">attribute names</dfn>
<a href="terminology.html#must-requirement" id="must-requirement_xref29">must</a>
consist of one or more characters other than the
<a href="terminology.html#space" id="space_xref18">space characters</a>,
U+0000 NULL,
"<code title="U+0022 QUOTATION MARK">"</code>",
"<code title="U+0027 APOSTROPHE">'</code>",
"<code title="U+003E GREATER-THAN SIGN">></code>",
"<code title="U+002F SOLIDUS">/</code>",
"<code title="U+003D EQUALS SIGN">=</code>",
the control characters,
and any characters that are not defined by Unicode.</li>
<li>
<dfn id="xml-compatible" role="button" tabindex="0" aria-haspopup="true">XML-compatible</dfn>
attribute names are those that match the
<a href="http://www.w3.org/TR/REC-xml/#NT-Name"><code>Name</code></a> production defined in
the XML specification <a href="references.html#refsXML" id="refsXML_xref6">[XML]</a>
and that contain no
"<code title="U+003A COLON">:</code>"
characters, and whose first three characters are not a
<a href="terminology.html#case-insensitive" id="case-insensitive_xref14">case-insensitive match</a>
for the string "<code>xml</code>".</li>
<li>
<dfn id="syntax-attribute-value" role="button" tabindex="0" aria-haspopup="true">attribute values</dfn>
can contain
<a href="syntax.html#syntax-text" id="syntax-text_xref1">text</a>
and
<a href="syntax.html#syntax-charref" id="syntax-charref_xref2">character references</a>,
with additional restrictions depending on whether they are
<a href="syntax.html#attr-value-unquoted" id="attr-value-unquoted_xref1">unquoted attribute values</a>,
<a href="syntax.html#attr-value-single-quoted" id="attr-value-single-quoted_xref1">single-quoted attribute values</a>,
or
<a href="syntax.html#attr-value-double-quoted" id="attr-value-double-quoted_xref1">double-quoted attribute values</a>.
Also, the <a href="elements.html">HTML elements</a> section
of this reference describes further restrictions on the
allowed values of particular attributes, and attributes
<a href="terminology.html#must-requirement" id="must-requirement_xref30">must</a>
have values that conform to those restrictions.</li>
</ul>
<p>In the <a href="documents.html#html-syntax" id="html-syntax_xref7">the HTML syntax</a>,
attributes can be specified in four different ways:</p>
<ol>
<li><a href="syntax.html#syntax-attr-empty" id="syntax-attr-empty_xref1">empty attribute syntax</a></li>
<li><a href="syntax.html#syntax-attr-unquoted" id="syntax-attr-unquoted_xref2">unquoted attribute-value syntax</a></li>
<li><a href="syntax.html#syntax-attr-single-quoted" id="syntax-attr-single-quoted_xref1">single-quoted attribute-value syntax</a></li>
<li><a href="syntax.html#syntax-attr-double-quoted" id="syntax-attr-double-quoted_xref1">double-quoted attribute-value syntax</a></li>
</ol>
<dl>
<dt><dfn id="syntax-attr-empty" role="button" tabindex="0" aria-haspopup="true">empty attribute syntax</dfn></dt>
<dd>
<p>Certain attributes may be specified by providing just the
<a href="syntax.html#attribute-name" id="attribute-name_xref4">attribute name</a>,
with no value.</p>
<div class="example">
<p>In the following example, the
<code title="attr-input-disabled">disabled</code>
attribute is given with the empty attribute
syntax:</p>
<pre><input <em>disabled</em>></pre>
<p>Note that
<a href="syntax.html#syntax-attr-empty" id="syntax-attr-empty_xref2">empty attribute syntax</a>
is exactly equivalent to specifying the empty string as the
value for the attribute, as in the following example.</p>
<pre><input <em>disabled=""</em>></pre>
</div>
</dd>
<dt><dfn id="syntax-attr-unquoted" title="syntax-attr-unquoted" role="button" tabindex="0" aria-haspopup="true">unquoted attribute-value syntax</dfn></dt>
<dd>
<p>An
<dfn id="attr-value-unquoted" title="attr-value-unquoted" role="button" tabindex="0" aria-haspopup="true">unquoted attribute value</dfn>
is specified by providing the following parts in exactly
the following order:</p>
<ol>
<li>an
<a href="syntax.html#attribute-name" id="attribute-name_xref5">attribute name</a>
</li>
<li>zero or more
<a href="terminology.html#space" id="space_xref19">space characters</a>
</li>
<li>a single
"<code title="U+003D EQUALS SIGN">=</code>"
character</li>
<li>zero or more
<a href="terminology.html#space" id="space_xref20">space characters</a>
</li>
<li>an
<a href="syntax.html#syntax-attribute-value" id="syntax-attribute-value_xref2">attribute value</a>
</li>
</ol>
<p>In addition to the
<a href="syntax.html#syntax-attribute-value" id="syntax-attribute-value_xref3">general requirements for attribute values</a>,
an unquoted attribute value has the following restrictions:</p>
<ul>
<li>
<a href="terminology.html#must-requirement" id="must-requirement_xref31">must</a>
not contain any literal
<a href="terminology.html#space" id="space_xref21">space characters</a>
</li>
<li>
<a href="terminology.html#must-requirement" id="must-requirement_xref32">must</a>
not contain any
"<code title="U+0022 QUOTATION MARK">"</code>",
"<code title="U+0027 APOSTROPHE">'</code>",
"<code title="U+003D EQUALS SIGN">=</code>",
"<code title="U+003E GREATER-THAN SIGN">></code>",
"<code title="U+003C LESS-THAN SIGN "><</code>",
or
"<code title="U+0060 GRAVE ACCENT">`</code>",
characters</li>
<li>
<a href="terminology.html#must-requirement" id="must-requirement_xref33">must</a>
not be the empty string</li>
</ul>
<div class="example">
<p>In the following example, the
<code title="attr-input-value">value</code>
attribute is given with the unquoted attribute value
syntax:</p>
<pre><input <em>value=yes</em>></pre>
</div>
<p>If the value of an attribute using the unquoted
attribute syntax is followed by a
"<code title="U+002F SOLIDUS">/</code>"
character, then there
<a href="terminology.html#must-requirement" id="must-requirement_xref34">must</a>
be at least one
<a href="terminology.html#space" id="space_xref22">space character</a>
after the value and before the
"<code title="U+002F SOLIDUS">/</code>"
character.</p>
</dd>
<dt><dfn id="syntax-attr-single-quoted" role="button" tabindex="0" aria-haspopup="true">single-quoted attribute-value syntax</dfn></dt>
<dd>
<p>A
<dfn id="attr-value-single-quoted" title="attr-value-single-quoted" role="button" tabindex="0" aria-haspopup="true">single-quoted attribute value</dfn>
is specified by providing the following parts in exactly
the following order:</p>
<ol>
<li>an
<a href="syntax.html#attribute-name" id="attribute-name_xref6">attribute name</a>
</li>
<li>zero or more
<a href="terminology.html#space" id="space_xref23">space characters</a>
</li>
<li>a
"<code title="U+003D EQUALS SIGN">=</code>"
character</li>
<li>zero or more
<a href="terminology.html#space" id="space_xref24">space characters</a>
</li>
<li>a single
"<code title="U+0027 APOSTROPHE">'</code>"
character</li>
<li>an
<a href="syntax.html#syntax-attribute-value" id="syntax-attribute-value_xref4">attribute value</a>
</li>
<li>a
"<code title="U+0027 APOSTROPHE">'</code>"
character.</li>
</ol>
<p>In addition to the
<a href="syntax.html#syntax-attribute-value" id="syntax-attribute-value_xref5">general requirements for attribute values</a>,
a single-quoted attribute value has the following restriction:</p>
<ul>
<li>
<a href="terminology.html#must-requirement" id="must-requirement_xref35">must</a>
not contain any literal
"<code title="U+0027 APOSTROPHE">'</code>"
characters</li>
</ul>
<div class="example">
<p>In the following example, the
<code title="attr-input-type">type</code> attribute
is given with the single-quoted attribute value
syntax:</p>
<pre><input <em>type='checkbox'</em>></pre>
</div>
</dd>
<dt><dfn id="syntax-attr-double-quoted" role="button" tabindex="0" aria-haspopup="true">double-quoted attribute-value syntax</dfn></dt>
<dd>
<p>A
<dfn id="attr-value-double-quoted" title="attr-value-double-quoted" role="button" tabindex="0" aria-haspopup="true">double-quoted attribute value</dfn>
is specified by providing the following parts in exactly
the following order:</p>
<ol>
<li>an
<a href="syntax.html#attribute-name" id="attribute-name_xref7">attribute name</a>
</li>
<li>zero or more
<a href="terminology.html#space" id="space_xref25">space characters</a>
</li>
<li>a single
"<code title="U+003D EQUALS SIGN character">=</code>"
character</li>
<li>zero or more
<a href="terminology.html#space" id="space_xref26">space characters</a>
</li>
<li>a single
"<code title="U+0022 QUOTATION MARK">"</code>"
character</li>
<li>an
<a href="syntax.html#syntax-attribute-value" id="syntax-attribute-value_xref6">attribute value</a>
</li>
<li>a
"<code title="double U+0022 QUOTATION MARK">"</code>"
character</li>
</ol>
<p>In addition to the
<a href="syntax.html#syntax-attribute-value" id="syntax-attribute-value_xref7">general requirements for attribute values</a>,
a double-quoted attribute value has the following restriction:</p>
<ul>
<li>
<a href="terminology.html#must-requirement" id="must-requirement_xref36">must</a>
not contain any literal
"<code title="U+0022 QUOTATION MARK">"</code>"
characters</li>
</ul>
<div class="example">
<p>In the following example, the
<code>title</code> attribute is
given with the double-quoted attribute value syntax:</p>
<pre><code title="U+003C LESS-THAN SIGN">&lt;</code></pre>
</div>
</dd>
</dl>
</div>
<div id="text-syntax" class="section">
<h2>4.5. Text and character data <a class="hash" href="#text-syntax">#</a> <a class="toc-bak" href="Overview.html#text-syntax-toc">T</a>
</h2>
<p><dfn id="syntax-text" title="syntax-text" role="button" tabindex="0" aria-haspopup="true">text</dfn>
in
<a href="syntax.html#contents" id="contents_xref9">element contents</a>
(including in
<a href="syntax.html#syntax-comments" id="syntax-comments_xref5">comments</a>)
and
<a href="syntax.html#syntax-attribute-value" id="syntax-attribute-value_xref8">attribute values</a>
<a href="terminology.html#must-requirement" id="must-requirement_xref37">must</a>
consist of Unicode characters, with the following
restrictions:</p>
<ul>
<li>
<a href="terminology.html#must-requirement" id="must-requirement_xref38">must</a>
not contain U+0000 characters</li>
<li>
<a href="terminology.html#must-requirement" id="must-requirement_xref39">must</a>
not contain permanently undefined Unicode characters</li>
<li>
<a href="terminology.html#must-requirement" id="must-requirement_xref40">must</a>
not contain control characters other than
<a href="terminology.html#space" id="space_xref27">space characters</a>
</li>
</ul>
<p><dfn id="character-data" title="character-data" role="button" tabindex="0" aria-haspopup="true">character data</dfn> contains
<a href="syntax.html#syntax-text" id="syntax-text_xref2">text</a>, in some cases in combination with
<a href="syntax.html#syntax-charref" id="syntax-charref_xref3">character references</a>,
along with certain additional restrictions. There are three
types of character data that can occur in documents:</p>
<ol>
<li><a href="syntax.html#normal-character-data" id="normal-character-data_xref3">normal character data</a></li>
<li><a href="syntax.html#replaceable-character-data" id="replaceable-character-data_xref1">replaceable character data</a></li>
<li><a href="syntax.html#non-replaceable-character-data" id="non-replaceable-character-data_xref1">non-replaceable character data</a></li>
</ol>
<dl id="character-data-types-list">
<dt><dfn id="normal-character-data" title="normal-character-data" role="button" tabindex="0" aria-haspopup="true">normal character data</dfn></dt>
<dd>
<p>Certain elements contain normal character data.
Normal character data can contain the following:</p>
<ul>
<li><a href="syntax.html#syntax-text" id="syntax-text_xref3">text</a></li>
<li><a href="syntax.html#syntax-charref" id="syntax-charref_xref4">character references</a></li>
</ul>
<p>Normal character data has the following restrictions:</p>
<ul>
<li>
<a href="terminology.html#must-requirement" id="must-requirement_xref41">must</a>
not contain any
"<code title="U+003C LESS-THAN SIGN"><</code>"
characters</li>
</ul>
</dd>
<dt><dfn id="replaceable-character-data" title="replaceable-character-data" role="button" tabindex="0" aria-haspopup="true">replaceable character data</dfn></dt>
<dd>
<p>In
<a href="documents.html#syntax-document-html" id="syntax-document-html_xref9">documents in the HTML syntax</a>,
the
<a href="title.html#title" class="element">title</a>
and
<a href="textarea.html#textarea" class="element">textarea</a>
elements can contain replaceable character data.
Replaceable character data can contain the following:</p>
<ul>
<li>
<a href="syntax.html#syntax-text" id="syntax-text_xref4">text</a>,
optionally including
"<code title="U+003C LESS-THAN SIGN"><</code>"
characters
</li>
<li><a href="syntax.html#syntax-charref" id="syntax-charref_xref5">character references</a></li>
</ul>
<p>Replaceable character data has the following restrictions:</p>
<ul>
<li>
<a href="terminology.html#must-requirement" id="must-requirement_xref42">must</a>
not contain any
<a href="syntax.html#syntax-ambiguous-ampersand" id="syntax-ambiguous-ampersand_xref1">ambiguous ampersands</a>
</li>
<li>
<a href="terminology.html#must-requirement" id="must-requirement_xref43">must</a>
not contain any occurrences of the string
"<code title="U+003C LESS-THAN SIGN, U+002F SOLIDUS"></</code>"
followed by characters that are a
<a href="terminology.html#case-insensitive" id="case-insensitive_xref15">case-insensitive match</a>
for the tag name of the element containing the
replaceable character data (for example,
"<code></title</code>" or
"<code></textarea</code>"),
followed by a
<a href="terminology.html#space" id="space_xref28">space character</a>,
"<code title="U+003E GREATER-THAN SIGN">></code>",
or
"<code title="U+002F SOLIDUS">/</code>".</li>
</ul>
<p class="note">Replaceable character data,
as described in this reference, is a feature of
<a href="documents.html#html-syntax" id="html-syntax_xref8">the HTML syntax</a>
that is not available in
<a href="documents.html#xml-syntax" id="xml-syntax_xref5">the XML syntax</a>.
<a href="documents.html#syntax-document-xml" id="syntax-document-xml_xref8">Documents in the XML
syntax</a>
<a href="terminology.html#must-requirement" id="must-requirement_xref44">must</a>
not contain replaceable character data
as described in this reference; instead they
<a href="terminology.html#must-requirement" id="must-requirement_xref45">must</a>
conform to all syntax constraints described in the XML
specification <a href="references.html#refsXML" id="refsXML_xref7">[XML]</a>.</p>
</dd>
<dt><dfn id="non-replaceable-character-data" title="non-replaceable-character-data" role="button" tabindex="0" aria-haspopup="true">non-replaceable character data</dfn></dt>
<dd>
<p>In
<a href="documents.html#syntax-document-html" id="syntax-document-html_xref10">documents in the HTML syntax</a>,
the
<a href="script.html#script" class="element">script</a>,
and
<a href="style.html#style" class="element">style</a>
elements can contain non-replaceable character data.
Non-replaceable character data can contain the
following:</p>
<ul>
<li>
<a href="syntax.html#syntax-text" id="syntax-text_xref5">text</a>,
optionally including
"<code title="U+003C LESS-THAN SIGN"><</code>"
characters
</li>
<li><a href="syntax.html#syntax-ambiguous-ampersand" id="syntax-ambiguous-ampersand_xref2">ambiguous ampersands</a></li>
</ul>
<p>Non-replaceable character data has the following restrictions:</p>
<ul>
<li>
<a href="terminology.html#must-requirement" id="must-requirement_xref46">must</a>
not contain <a href="syntax.html#syntax-charref" id="syntax-charref_xref6">character references</a>
</li>
<li>
<a href="terminology.html#must-requirement" id="must-requirement_xref47">must</a>
not contain any occurrences of the string
"<code title="U+003C LESS-THAN SIGN, U+002F SOLIDUS"></</code>",
followed by characters that are a
<a href="terminology.html#case-insensitive" id="case-insensitive_xref16">case-insensitive match</a>
for the tag name of the element containing the
replaceable character data (for example,
"<code></script</code>"
or
"<code></style</code>",
followed by a
<a href="terminology.html#space" id="space_xref29">space character</a>,
"<code title="U+003E GREATER-THAN SIGN">></code>",
or
"<code title="U+002F SOLIDUS">/</code>".</li>
</ul>
<p class="note">Non-replaceable character data,
as described in this reference, is a feature of
<a href="documents.html#html-syntax" id="html-syntax_xref9">the HTML syntax</a>
that is not available in
<a href="documents.html#xml-syntax" id="xml-syntax_xref6">the XML syntax</a>.
<a href="documents.html#syntax-document-xml" id="syntax-document-xml_xref9">Documents in the XML
syntax</a>
<a href="terminology.html#must-requirement" id="must-requirement_xref48">must</a>
not contain non-replaceable character
data as described in this reference; instead they
<a href="terminology.html#must-requirement" id="must-requirement_xref49">must</a>
conform to all syntax constraints defined in the XML
specification <a href="references.html#refsXML" id="refsXML_xref8">[XML]</a>.</p>
</dd>
</dl>
</div>
<div id="character-references" class="section">
<h2>4.6. Character references <a class="hash" href="#character-references">#</a> <a class="toc-bak" href="Overview.html#character-references-toc">T</a>
</h2>
<p><dfn id="syntax-charref" role="button" tabindex="0" aria-haspopup="true">character references</dfn> are a form
of markup for representing single individual characters. There
are three types of character references:</p>
<ul>
<li><a href="syntax.html#named-charref" id="named-charref_xref1">named character references</a></li>
<li><a href="syntax.html#dec-charref" id="dec-charref_xref1">decimal numeric character references</a></li>
<li><a href="syntax.html#hex-charref" id="hex-charref_xref1">hexadecimal numeric character references</a></li>
</ul>
<dl>
<dt><dfn id="named-charref" role="button" tabindex="0" aria-haspopup="true">named character reference</dfn></dt>
<dd>
<p>Named character references consist of the following
parts in exactly the following order:</p>
<ol>
<li>An
"<code title="U+0026 AMPERSAND">&</code>"
character.</li>
<li>One of the names listed in
the “Named character references” section of the HTML5
specification
<a href="references.html#refsHTML5" id="refsHTML5_xref5">[HTML5]</a>,
using the same case.</li>
<li>A
"<code title="U+003B SEMICOLON">;</code>"
character.</li>
</ol>
<div class="note">
<p>For further information about named character references, see
<a href="references.html#refsXMLEntities" id="refsXMLEntities_xref1">[XML Entities]</a>.</p>
</div>
<div class="example">
<p>The following is an example of a named character
reference for the character