#pattern
* The HTML syntax
#ja
$1 HTML 構文
#pattern
* Writing HTML documents
#ja
$1 HTML 文書を書く
#en
This section only applies to documents, authoring tools, and markup
generators. In particular, it does not apply to conformance checkers;
conformance checkers must use the requirements given in the next section
("parsing HTML documents").
#ja
この節は文書、著述ツール、マーク付け生成器にのみ適用されます。
特に、適合性検査器には適用されません。
適合性検査器は次の節 (「HTML 文書の構文解析」) で与えられる要件を用いなければ[[MUST:なりません]]。
#en
Documents must consist of the following parts, in the given order:
#ja
文書は、次に示す部分により、次の順序で構成されなければ[[MUST:なりません]]。
#en
Optionally, a single U+FEFF BYTE ORDER MARK (BOM) character.
#ja
任意選択で、1つの U+FEFF BYTE ORDER MARK (BOM) 文字。
#en
Any number of comments
and space characters.
#ja
任意の個数の注釈と間隔文字。
#en
A DOCTYPE.
#ja
DOCTYPE。
#en
The root element, in the form of an html element.
#ja
根要素を html 要素の形で。
#en
The various types of content mentioned above are described in the next
few sections.
#ja
前述の各種の内容は、次の数個の節で説明します。
#en
In addition, there are some restrictions on how character encoding
declarations are to be serialized, as discussed in the section on
that topic.
#ja
加えて、文字符号化宣言をどう直列化するかについても、
それに関する節で説明した通り、いくつかの制限があります。
#en
Space characters before the root html
element, and space characters at the start of the html element and before the head element, will be dropped when the document
is parsed; space characters after the root html element will be parsed as if they were at
the end of the body element. Thus,
space characters around the root element do not round-trip.
#ja
根 html 要素の前の間隔文字や、
html 要素のはじめで head 要素の前の間隔文字は、
文書が構文解析される時に除去されます。根 html 要素の後の間隔文字は、
body 要素の終わりにあったものとして構文解析されます。
従って、根要素の近辺の間隔文字は往復しません。
#en
It is suggested that newlines be inserted after the DOCTYPE, after any
comments that are before the root element, after the html element's start tag (if it is not omitted), and after any
comments that are inside the html
element but before the head element.
#ja
DOCTYPE の後、
根要素の前の注釈がある場合はその後、
html 要素の開始タグの後
(省略しない場合)、
html 要素中で
head 要素の前に注釈がある場合にはその後には、
改行を挿入することをおすすめします。
#en
Many strings in the HTML syntax (e.g. the names of elements and their
attributes) are case-insensitive, but only for characters in the ranges
U+0041 .. U+005A (LATIN CAPITAL LETTER A to LATIN CAPITAL LETTER Z) and
U+0061 .. U+007A (LATIN SMALL LETTER A to LATIN SMALL LETTER Z). For
convenience, in this section this is just referred to as
"case-insensitive".
#ja
HTML 構文中の多くの文字列 (例えば要素や属性の名前) は大文字と小文字を区別しませんが、
区別しないのは範囲
U+0041 ~ U+005A (LATIN CAPITAL LETTER A ~ LATIN CAPITAL LETTER Z) と
範囲 U+0061 ~ U+007A (LATIN SMALL LETTER A ~ LATIN SMALL LETTER Z)
の文字についてのみです。便宜上、この節ではこれを単に「大文字・小文字を区別しない」と呼びます。
#pattern
* The DOCTYPE
#ja
$1 DOCTYPE
#en
A DOCTYPE is a mostly
useless, but required, header.
#ja
DOCTYPE はほとんど無意味ですが、
[[REQUIRED:必須]]の頭部です。
#en
DOCTYPEs are required for legacy reasons. When omitted,
browsers tend to use a different rendering mode that is incompatible with
some specifications. Including the DOCTYPE in a document ensures that the
browser makes a best-effort attempt at following the relevant
specifications.
#ja
DOCTYPE は遺物的な理由で[[REQUIRED:必須]]です。
省略すると、ブラウザはいくつかの仕様書と非互換な異なるレンダリング・モードを使おうとします。
DOCTYPE を文書に含めることによってブラウザに関係する仕様書に従うよう最善の努力を試みさせるようにします。
#en
A DOCTYPE must consist of the following characters, in this order:
#ja
DOCTYPE は、次の文字により次の順序で構成されなければ[[MUST:なりません]]。
#en
A U+003C LESS-THAN SIGN (<) character.
#ja
U+003C LESS-THAN SIGN (<) 文字。
#en
A U+0021 EXCLAMATION MARK (!) character.
#ja
U+0021 EXCLAMATION MARK (!) 文字。
#en
A U+0044 LATIN CAPITAL LETTER D or U+0064 LATIN SMALL LETTER D
character.
#ja
U+0044 LATIN CAPITAL LETTER D 文字か U+0064 LATIN SMALL LETTER D 文字。
#en
A U+004F LATIN CAPITAL LETTER O or U+006F LATIN SMALL LETTER O
character.
#ja
U+004F LATIN CAPITAL LETTER O 文字か U+006F LATIN SMALL LETTER O 文字。
#en
A U+0043 LATIN CAPITAL LETTER C or U+0063 LATIN SMALL LETTER C
character.
#ja
U+0043 LATIN CAPITAL LETTER C 文字か U+0063 LATIN SMALL LETTER C 文字。
#en
A U+0054 LATIN CAPITAL LETTER T or U+0074 LATIN SMALL LETTER T
character.
#ja
U+0054 LATIN CAPITAL LETTER T 文字か U+0074 LATIN SMALL LETTER T 文字。
#en
A U+0059 LATIN CAPITAL LETTER Y or U+0079 LATIN SMALL LETTER Y
character.
#ja
U+0059 LATIN CAPITAL LETTER Y 文字か U+0079 LATIN SMALL LETTER Y 文字。
#en
A U+0050 LATIN CAPITAL LETTER P or U+0070 LATIN SMALL LETTER P
character.
#ja
U+0050 LATIN CAPITAL LETTER P 文字か U+0070 LATIN SMALL LETTER P 文字。
#en
A U+0045 LATIN CAPITAL LETTER E or U+0065 LATIN SMALL LETTER E
character.
#ja
U+0045 LATIN CAPITAL LETTER E 文字か U+0065 LATIN SMALL LETTER E 文字。
#en
One or more space
characters.
#ja
1つ以上の間隔文字。
#en
A U+0048 LATIN CAPITAL LETTER H or U+0068 LATIN SMALL LETTER H
character.
#ja
U+0048 LATIN CAPITAL LETTER H 文字か U+0068 LATIN SMALL LETTER H 文字。
#en
A U+004D LATIN CAPITAL LETTER M or U+006D LATIN SMALL LETTER M
character.
#ja
U+004D LATIN CAPITAL LETTER M 文字か U+006D LATIN SMALL LETTER M 文字。
#en
A U+004C LATIN CAPITAL LETTER L or U+006C LATIN SMALL LETTER L
character.
#ja
U+004C LATIN CAPITAL LETTER L 文字か U+006C LATIN SMALL LETTER L 文字。
#en
Zero or more space
characters.
#ja
零個以上の間隔文字。
#en
A U+003E GREATER-THAN SIGN (>) character.
#ja
U+003E GREATER-THAN SIGN (>) 文字。
#en
In other words, <!DOCTYPE HTML>,
case-insensitively.
#ja
つまり、大文字または小文字の <!DOCTYPE HTML> です。
#pattern
* Elements
#ja
$1 要素
#en
There are five different kinds of elements: void elements, CDATA elements,
RCDATA elements, foreign elements, and normal elements.
#ja
要素には5種類あります。
空隙要素、 CDATA 要素、 RCDATA 要素、外来要素、通常要素です。
#en
Void elements
#ja
空隙要素
#en
CDATA elements
#ja
CDATA 要素
#en
RCDATA elements
#ja
RCDATA 要素
#en
Foreign elements
#ja
外来要素
#en
Elements from the MathML namespace
#ja
body 要素の開始タグは、
body 要素の内側の最初のものが間隔文字や注釈でない場合、
body 要素の内側の最初のものが
script 要素や
style 要素の場合を除き、
省略して[[MAY:構いません]]。
#en
A body element's end
tag may be omitted if the body element is not
immediately followed by a comment and the element is either not
empty or its start tag has not
been omitted.
#ja
body 要素の終了タグは、
body 要素の直後が注釈ではなく、
要素が空ではないか、または開始タグが省略されていない場合、
省略して[[MAY:構いません]]。
#en
A li element's end
tag may be omitted if the li element is
immediately followed by another li element or if there
is no more content in the parent element.
#ja
li 要素の終了タグは、
li 要素の直後が別の
li 要素か、
親要素にそれ以上に内容がない場合、
省略して[[MAY:構いません]]。
#en
A dt element's end
tag may be omitted if the dt element is
immediately followed by another dt element or a
dd element.
#ja
dt 要素の終了タグは、
dt 要素の直後が別の
dt 要素か
dd 要素の場合、省略して[[MAY:構いません]]。
#en
A dd element's end
tag may be omitted if the dd element is
immediately followed by another dd element or a
dt element, or if there is no more content in the
parent element.
#ja
dd 要素の終了タグは、
dd 要素の直後が別の
dd 要素か
dt 要素の場合や、
親要素にそれ以上内容がない場合、省略して[[MAY:構いません]]。
#en
A p element's end
tag may be omitted if the p element is
immediately followed by an address,
article, aside, blockquote,
datagrid, dialog, dir,
div, dl, fieldset,
footer, form, h1,
h2, h3, h4, h5,
h6, header, hr,
menu, nav, ol,
p, pre, section,
table, or ul, element, or if there is no
more content in the parent element and the parent element is not an
a element.
#ja
p 要素の終了タグは、
p 要素の直後が
address、
article、aside、blockquote、
datagrid、dialog、dir、
div、dl、fieldset、
footer、form、h1、
h2、h3、h4、h5、
h6、header、hr、
menu、nav、ol、
p、pre、section、
table、 ul のいずれかの要素の場合や親要素にそれ以上に内容がなく、親要素が
a 要素ではない場合、
省略して[[MAY:構いません]]。
#en
An rt element's end
tag may be omitted if the rt element is
immediately followed by an rt or rp
element, or if there is no more content in the parent element.
#ja
rt 要素の終了タグは、
rt 要素の直後が
rt 要素や
rp 要素でない場合や、
親要素にそれ以上内容がない場合、
省略して[[MAY:構いません]]。
#en
An rp element's end
tag may be omitted if the rp element is
immediately followed by an rt or rp
element, or if there is no more content in the parent element.
#ja
rp 要素の終了タグは、
rp 要素の直後が
rt 要素や
rp 要素の場合や、
親要素にそれ以上内容がない場合、省略して[[MAY:構いません]]。
#en
An optgroup element's end tag may be omitted if the
optgroup element is immediately followed by
another optgroup element, or if there is no
more content in the parent element.
#ja
optgroup 要素の終了タグは、
optgroup 要素の直後が
別の optgroup 要素の場合や、
親要素にそれ以上内容がない場合、
省略して[[MAY:構いません]]。
#en
An option element's end
tag may be omitted if the option element is
immediately followed by another option element, or if
it is immediately followed by an optgroup element, or
if there is no more content in the parent element.
#ja
option 要素の終了タグは、
option 要素の直後が別の
option 要素の場合や、
直後が optgroup 要素の場合や、
親要素にそれ以上内容がない場合、省略して[[MAY:構いません]]。
#en
A colgroup element's start tag may be omitted if the
first thing inside the colgroup element is a
col element, and if the element is not immediately
preceded by another colgroup element whose end tag has been omitted.
#ja
colgroup 要素の開始タグは、
colgroup 要素の内側の最初のものが
col 要素の場合で、
直前が終了タグの省略された別の
colgroup 要素でない場合、
省略して[[MAY:構いません]]。
#en
A colgroup element's end tag may be omitted if the
colgroup element is not immediately followed by a
space character or a comment.
#ja
colgroup 要素の終了タグは、
colgroup 要素の直後が間隔文字や注釈でない場合、
省略して[[MAY:構いません]]。
#en
A thead element's end
tag may be omitted if the thead element is
immediately followed by a tbody or tfoot
element.
#ja
thead 要素の終了タグは、
thead 要素の直後が
tbody 要素や tfoot
要素の場合、省略して[[MAY:構いません]]。
#en
A tbody element's start tag may be omitted if the
first thing inside the tbody element is a
tr element, and if the element is not immediately
preceded by a tbody, thead, or
tfoot element whose end
tag has been omitted.
#ja
tbody 要素の開始タグは、
tbody 要素の内側の最初のものが
tr 要素の場合で、
要素の直前が終了タグの省略された
tbody 要素、thead 要素、
tfoot 要素でない場合、
省略して[[MAY:構いません]]。
#en
A tbody element's end
tag may be omitted if the tbody element is
immediately followed by a tbody or tfoot
element, or if there is no more content in the parent element.
#ja
tbody 要素の終了タグは、
tbody 要素の直後が
tbody 要素や tfoot
要素の場合や、親要素にそれ以上内容がない場合、省略して[[MAY:構いません]]。
#en
A tfoot element's end
tag may be omitted if the tfoot element is
immediately followed by a tbody element, or if there is
no more content in the parent element.
#ja
tfoot 要素の終了タグは、
tfoot 要素の直後が
tbody 要素の場合や、
親要素にそれ以上内容がない場合、省略して[[MAY:構いません]]。
#en
A tr element's end
tag may be omitted if the tr element is
immediately followed by another tr element, or if there
is no more content in the parent element.
#ja
tr 要素の終了タグは、
tr 要素の直後が別の
tr 要素の場合や、
親要素にそれ以上内容がない場合、省略して[[MAY:構いません]]。
#en
A td element's end
tag may be omitted if the td element is
immediately followed by a td or th
element, or if there is no more content in the parent element.
#ja
td 要素の終了タグは、
td 要素の直後が
td 要素や
th 要素の場合や、
親要素にそれ以上内容がない場合、省略して[[MAY:構いません]]。
#en
A th element's end
tag may be omitted if the th element is
immediately followed by a td or th
element, or if there is no more content in the parent element.
#ja
th 要素の終了タグは、th 要素の直後が
td 要素や
th 要素の場合や、
親要素にそれ以上内容がない場合、省略して[[MAY:構いません]]。
#en
However, a start
tag must never be omitted if it has any attributes.
#ja
しかし、開始タグが属性を持つ場合、
開始タグを省略しては[[MUST:なりません]]。
#pattern
* Restrictions on content models
#ja
$1 内容モデルの制限
#en
For historical reasons, certain elements have extra restrictions
beyond even the restrictions given by their content model.
#ja
歴史的理由により、内容モデルによる制限以上の追加の制限を持つ要素がいくつかあります。
#en
An optgroup element must not contain
optgroup elements, even though these elements are
technically allowed to be nested according to the content models
described in this specification. (If an optgroup
element is put inside another in the markup, it will in
fact imply an optgroup end tag before it.)
#ja
optgroup 要素は、
この仕様書で述べた内容モデルに従えば技術的には入れ子にできますが、
optgroup
要素を含んでは[[MUST NOT:なりません]]。
(optgroup
要素をマーク付け中で別の
optgroup 要素中に配置しても、
実際にはその前に optgroup
終了タグが暗示的に存在するものとみなされます。)
#en
A table element must not contain tr
elements, even though these elements are technically allowed inside
table elements according to the content models
described in this specification. (If a tr element is
put inside a table in the markup, it will in fact imply
a tbody start tag before it.)
#ja
table
要素はこの仕様書で述べた内容モデルに従えば技術的には内側で
tr 要素が認められていますが、
table
要素は tr 要素を含んでは[[MUST NOT:なりません]]。
(tr 要素がマーク付け中で
table 要素の内側に置かれた場合、
実際には前に tbody 開始タグが暗示的に存在するものとみなされます。)
#en
A single U+000A LINE FEED (LF) character may be placed
immediately after the start
tag of pre and textarea
elements. This does not affect the processing of the element. The
otherwise optional U+000A LINE FEED (LF) character must be
included if the element's contents start with that character
(because otherwise the leading newline in the contents would be
treated like the optional newline, and ignored).
#ja
pre 要素と
textarea
要素の開始タグの直後に1文字の
U+000A LINE FEED (LF) 文字を置いても[[MAY:構いません]]。
この文字は要素の処理に影響しません。
通常は任意選択のこの U+000A LINE FEED (LF) 文字は、
要素の内容がこの文字から始まる場合には、含めなければ[[MUST:なりません]]
(そうしなければ、内容の最初の改行は任意選択の改行として扱われ、無視されるからです)。
#en
The following two pre blocks are equivalent:
#ja
次の2つの pre
ブロックは等価です。
#en
<pre>Hello</pre>
#ja
<pre>こんにちは</pre>
#en
<pre>
Hello</pre>
#ja
<pre>
こんにちは</pre>
#en
* Restrictions on the contents of CDATA and RCDATA elements
#ja
$1 CDATA 要素や RCDATA 要素の内容の制限
#en
The text in CDATA and RCDATA elements must not contain any
occurrences of the string "</" (U+003C
LESS-THAN SIGN, U+002F SOLIDUS) followed by characters that
case-insensitively match the tag name of the element followed by one
of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM
FEED (FF), U+0020 SPACE, U+003E GREATER-THAN SIGN (>), or U+002F
SOLIDUS (/), unless that string is part of an escaping text span.
#ja
CDATA 要素や RCDATA 要素のテキストは文字列「</」 (U+003C
LESS-THAN SIGN、U+002F SOLIDUS) の後に要素のタグ名と大文字・小文字を区別しない場合に一致する文字が続き、
その後に U+0009 CHARACTER TABULATION、U+000A LINE FEED (LF)、U+000C FORM
FEED (FF)、U+0020 SPACE、U+003E GREATER-THAN SIGN (>)、U+002F
SOLIDUS (/)
のいずれかが続くような列を、その文字列が逃避テキスト径間の一部である場合を除き、
含んでは[[MUST NOT:なりません]]。
#en
An escaping text span is a span
of text that starts with an escaping text span start that is
not itself in an escaping text
span, and ends at the next escaping text span end. There
cannot be any character
references inside an escaping
text span.
#ja
逃避テキスト径間は、
テキストの径間であって、
それ自体は逃避テキスト径間中にない逃避テキスト径間開始によって始まり、
次の逃避テキスト径間によって終わるものです。
逃避テキスト径間の内側には文字参照を入れることができません。
#en
An escaping text span
start is a part of text that
consists of the four character sequence "<!--" (U+003C LESS-THAN SIGN, U+0021 EXCLAMATION
MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS).
#ja
逃避テキスト径間開始は、
テキストの一部で、
4文字の列「<!--」(U+003C LESS-THAN SIGN、U+0021 EXCLAMATION
MARK、U+002D HYPHEN-MINUS、U+002D HYPHEN-MINUS) です。
#en
An escaping text span
start may share its U+002D HYPHEN-MINUS characters with its
corresponding escaping text span
end.
#ja
逃避テキスト径間開始は、
その U+002D HYPHEN-MINUS 文字を対応する逃避テキスト径間終了と共有して[[MAY:構いません]]。
#en
The text in CDATA and RCDATA elements must not have an escaping text span start that is
not followed by an escaping text
span end.
#ja
CDATA 要素と RCDATA 要素のテキストは逃避テキスト径間終了が後に続かない逃避テキスト径間開始を含んでは[[MUST NOT:なりません]]。
#pattern
* Text
#ja
$1 テキスト
#en
Text is allowed inside elements,
attributes, and comments. Text must consist of Unicode characters.
Text must not contain U+0000 characters. Text must not contain
permanently undefined Unicode characters. Text must not contain
control characters other than space
characters. Extra constraints are placed on what is and what
is not allowed in text based on where the text is to be put, as
described in the other sections.
#ja
テキストは要素、
属性、注釈の内側で認められています。
テキストは Unicode 文字で構成されなければ[[MUST:なりません]]。
テキストは U+0000 文字を含んでは[[MUST NOT:なりません]]。
テキストは恒久的に未定義の Unicode 文字を含んでは[[MUST NOT:なりません]]。
テキストは間隔文字以外の制御文字を含んでは[[MUST NOT:なりません]]。
他の節で述べた通り、テキストが配置される場所によって、テキスト中で何が認められ、
何が認められないかの追加の制約があります。
#pattern
* Newlines
#ja
$1 改行
#en
Newlines in HTML may be
represented either as U+000D CARRIAGE RETURN (CR) characters, U+000A
LINE FEED (LF) characters, or pairs of U+000D CARRIAGE RETURN (CR),
U+000A LINE FEED (LF) characters in that order.
#ja
HTML の改行は
U+000D CARRIAGE RETURN (CR) 文字か、U+000A
LINE FEED (LF) 文字か、U+000D CARRIAGE RETURN (CR) 文字と
U+000A LINE FEED (LF) 文字の組をこの順序で用いるかのいずれかによって表現して[[MAY:構いません]]。
#pattern
* Character references
#ja
$1 文字参照
#en
In certain cases described in other sections, text may be mixed with character references. These can be used
to escape characters that couldn't otherwise legally be included in
text.
#ja
他の節で述べたいくつかの場合において、テキストには
文字参照を混在させて[[MAY:構いません]]。
文字参照は、通常合法的にテキストに含めることができない文字を逃避するために使うことができます。
#en
Character references must start with a U+0026 AMPERSAND
(&). Following this, there are three possible kinds
of character references:
#ja
文字参照は、U+0026 AMPERSAND
(&) により始まらなければ[[MUST:なりません]]。
この文字に続けて、3種類の文字参照があります。