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
|
---
title: '<dl>: 説明リスト要素'
slug: Web/HTML/Element/dl
tags:
- Definition List
- Description list
- Element
- HTML
- HTML grouping content
- HTML:Flow content
- HTML:Palpable Content
- Reference
- Web
browser-compat: html.elements.dl
translation_of: Web/HTML/Element/dl
---
<div>{{HTMLRef}}</div>
<p><strong>HTML の <code><dl></code></strong> 要素は、説明リストを表します。この要素は、一連の用語 ({{HTMLElement("dt")}} 要素を使用して指定) と説明 ({{HTMLElement("dd")}} 要素によって提供) をリスト化したものです。一般的な使用例として、用語集の作成やメタデータ (キーと値のペアのリスト) の表示が挙げられます。</p>
<div>{{EmbedInteractiveExample("pages/tabbed/dl.html", "tabbed-standard")}}</div>
<table class="properties">
<tbody>
<tr>
<th scope="row"><a href="/ja/docs/Web/Guide/HTML/Content_categories">コンテンツカテゴリー</a></th>
<td><a href="/ja/docs/Web/Guide/HTML/Content_categories#flow_content">フローコンテンツ</a>、<code><dl></code> 要素の子要素が 1 つの名前と値のグループの場合は知覚可能コンテンツ</td>
</tr>
<tr>
<th scope="row">許可されている内容</th>
<td>
<p>1 個以上の {{HTMLElement("dt")}} 要素とそれに続く 1 個以上の {{HTMLElement("dd")}} 要素、任意で {{HTMLElement("script")}} 要素や {{HTMLElement("template")}} 要素が混在するもの。<br>
または ({{Glossary("WHATWG")}} HTML や {{Glossary("W3C")}} HTML 5.2 以降では) 1 個以上の {{HTMLElement("div")}} 要素、任意で {{HTMLElement("script")}} 要素や {{HTMLElement("template")}} 要素が混在するもの。</p>
</td>
</tr>
<tr>
<th scope="row">タグの省略</th>
<td>{{no_tag_omission}}</td>
</tr>
<tr>
<th scope="row">許可されている親要素</th>
<td><a href="/ja/docs/Web/Guide/HTML/Content_categories#flow_content">フローコンテンツ</a>を受け入れるすべての要素</td>
</tr>
<tr>
<th scope="row">暗黙の ARIA ロール</th>
<td><a href="https://www.w3.org/TR/html-aria/#dfn-no-corresponding-role">対応するロールなし</a></td>
</tr>
<tr>
<th scope="row">許可されている ARIA ロール</th>
<td>{{ARIARole("group")}}, <code><a href="/ja/docs/Web/Accessibility/ARIA/Roles/List_role">list</a></code>, {{ARIARole("none")}}, {{ARIARole("presentation")}}</td>
</tr>
<tr>
<th scope="row">DOM インターフェイス</th>
<td>{{domxref("HTMLDListElement")}}</td>
</tr>
</tbody>
</table>
<h2 id="Attributes">属性</h2>
<p>この要素には<a href="/ja/docs/Web/HTML/Global_attributes">グローバル属性</a>のみがあります。</p>
<h2 id="Examples">例</h2>
<h3 id="Single_term_and_description">一つの定義語に対する一つの定義説明</h3>
<pre class="brush: html"><dl>
<dt>Firefox</dt>
<dd>
A free, open source, cross-platform,
graphical web browser developed by the
Mozilla Corporation and hundreds of
volunteers.
</dd>
<!-- Other terms and descriptions -->
</dl>
</pre>
<p>{{EmbedLiveSample("Single_term_and_description")}}</p>
<h3 id="Multiple_terms_single_description">複数の定義語に対する一つの定義説明</h3>
<pre class="brush: html"><dl>
<dt>Firefox</dt>
<dt>Mozilla Firefox</dt>
<dt>Fx</dt>
<dd>
A free, open source, cross-platform,
graphical web browser developed by the
Mozilla Corporation and hundreds of
volunteers.
</dd>
<!-- Other terms and descriptions -->
</dl>
</pre>
<p>{{EmbedLiveSample("Multiple_terms_single_description")}}</p>
<h3 id="Single_term_multiple_descriptions">一つの定義語に対し、複数の定義内容をあてる</h3>
<pre class="brush: html"><dl>
<dt>Firefox</dt>
<dd>
A free, open source, cross-platform,
graphical web browser developed by the
Mozilla Corporation and hundreds of
volunteers.
</dd>
<dd>
The Red Panda also known as the Lesser
Panda, Wah, Bear Cat or Firefox, is a
mostly herbivorous mammal, slightly larger
than a domestic cat (60 cm long).
</dd>
<!-- Other terms and descriptions -->
</dl>
</pre>
<p>{{EmbedLiveSample("Single_term_multiple_descriptions")}}</p>
<h3 id="Multiple_terms_and_descriptions">複数の定義語に対し、複数の定義内容をあてる</h3>
<p>これまでの例を組み合わせることで、複数の定義語に対し、複数の内容を定義することもできます。</p>
<h3 id="Metadata">メタデータ</h3>
<p>説明リストは、キーと値のペアのリストであるメタデータの表示にも役立ちます。</p>
<pre class="brush: html"><dl>
<dt>Name</dt>
<dd>Godzilla</dd>
<dt>Born</dt>
<dd>1952</dd>
<dt>Birthplace</dt>
<dd>Japan</dd>
<dt>Color</dt>
<dd>Green</dd>
</dl>
</pre>
<p>ヒント: CSS でキーと値のセパレーターを定義すると便利でしょう。</p>
<pre class="brush: css">dt::after {
content: ": ";
}</pre>
<h3 id="Wrapping_name-value_groups_in_HTMLElementdiv_elements">名前と値のグループを <code>div</code> 要素で包む</h3>
<p><a href="/ja/docs/Glossary/WHATWG">WHATWG</a> HTML では、{{HTMLElement("dl")}} 要素内でそれそれの名前と値のグループを、{{HTMLElement("div")}} 要素でまとめることができます。これは <a href="/ja/docs/Web/HTML/Microdata">microdata</a> を使用するとき、グループ全体に <a href="/ja/docs/Web/HTML/Global_attributes">グローバル属性</a> を適用するとき、あるいはスタイルを設定するために役立ちます。</p>
<pre class="brush: html"><dl>
<div>
<dt>Name</dt>
<dd>Godzilla</dd>
</div>
<div>
<dt>Born</dt>
<dd>1952</dd>
</div>
<div>
<dt>Birthplace</dt>
<dd>Japan</dd>
</div>
<div>
<dt>Color</dt>
<dd>Green</dd>
</div>
</dl>
</pre>
<h2 id="Notes">メモ</h2>
<p>単なる字下げの目的でこの要素 (あるいは {{HTMLElement("ul")}} 要素) を使用するのは誤りです。そのように機能しますが、これは悪い慣習であり説明リストの意味を不明瞭にします。</p>
<p>用語の説明のインデントを変更するには、<a href="/ja/docs/Web/CSS">CSS</a> の {{cssxref("margin")}} プロパティを使用してください。</p>
<h2 id="Accessibility_concerns">アクセシビリティの考慮</h2>
<p>画面リーダーによって <code><dl></code> の内容の読み上げは異なります。 iOS 14 では、 VoiceOver は仮想カーソルで操作する際に、 <code><dl></code> の内容がリストであることをアナウンスします (read-all コマンドを使用しなくても)。このため、リストグループ内の他のリスト項目との関係が分かるような形でリスト項目の内容が書かれていることを確認してください。</p>
<ul>
<li><a href="https://codepen.io/aardrian/debug/NzGaKP">CodePen - HTML Buddies: dt & dd</a></li>
<li><a href="https://adrianroselli.com/2020/09/voiceover-on-ios-14-supports-description-lists.html">VoiceOver on iOS 14 Supports Description Lists</a></li>
</ul>
<h2 id="Specifications">仕様書</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">仕様書</th>
<th scope="col">状態</th>
<th scope="col">備考</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('HTML WHATWG', 'semantics.html#the-dl-element', '<dl>')}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
<td></td>
</tr>
<tr>
<td>{{SpecName('HTML5 W3C', 'grouping-content.html#the-dl-element', '<dl>')}}</td>
<td>{{Spec2('HTML5 W3C')}}</td>
<td>{{HTMLElement("div")}} 要素を中に入れ、 <code><dt></code> および <code><dd></code> 要素を囲むことができるようになった。</td>
</tr>
<tr>
<td>{{SpecName('HTML4.01', 'struct/lists.html#h-10.3', '<dl>')}}</td>
<td>{{Spec2('HTML4.01')}}</td>
<td>初回定義</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">ブラウザーの互換性</h2>
<p>{{Compat}}</p>
<h2 id="See_also">関連情報</h2>
<ul>
<li>{{HTMLElement("dt")}} 要素</li>
<li>{{HTMLElement("dd")}} 要素</li>
</ul>
|