一. 定义列表基本使用
<dl>
叫做定义列表(definition list
)或者描述列表.
是一个包含术语定义以及描述的列表,通常用于展示词汇表或者元数据 (键-值对列表)。
定义列表稍微复杂些, 需要三个标签配合使用.
<dl>
(definition list
)dt
(definition title
)dd
(definition description
)
1.1 单条术语和描述
<dl>
<dt>Firefox</dt>
<dd>A free, open source, cross-platform, graphical web browser
developed by the Mozilla Corporation and hundreds of volunteers.
</dd>
<dt>Chrome</dt>
<dd>一个免费开源超级牛逼的谷歌开发的浏览器</dd>
<!-- other terms and definitions -->
</dl>
1.2 多条术语,单条描述
<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>
<dt>Chrome</dt>
<dt>Google chrome</dt>
<dd>一个免费开源超级牛逼的谷歌开发的浏览器</dd>
<!-- other terms and definitions -->
</dl>
1.3 单条术语,多条描述
<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 definitions -->
</dl>
1.4 多条术语,多条描述
同样的,该元素同样可以支持在一个列表中出现多条术语以及多条描述。
1.5 元数据
描述列表可以很方便的将元数据展示为键-值对列表:
<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>
说明:
- 再次说明, 样式不重要, 重要的是语义.