← 返回列表

On the <dl>

Simon Willison 3 信息等级 3 1 噪音/剔除;2 较弱;3 普通事实;4 重要行业动态;5 极重大事件。该分数是信息显著性,不是投资建议。 发布:2026-05-23T20:24 抓取:2026-05-23 22:13
🔗 原文链接
摘要

文章介绍了HTML中<dl>元素的新知识:一个<dl>可跟随多个<dt>;<dt>和<dd>可被<div>分组(仅一个);可使用ARIA标签;自2008年HTML5草案起被称为描述列表。

客观事实
  • <dl>可以跟随多个<dt>
  • <dt>和<dd>可在单个<div>内分组
  • <dl>自2008年起被称为描述列表

原文

On the <dl>

I learned a few new-to-me things about the <dl> element from this article by Ben Meyer:

A <dt> can be followed by multiple <dd>
You can optionally group the <dt> and <dd> elements in a <div> for styling - but only a <div>.
You can label them using ARIA.
They've been called "description lists", not "definition lists", since an HTML5 draft in 2008.

So this is valid:

<h2 id="credits">Credits</h2>
<dl aria-labelledby="credits">
<div>
<dt>Author</dt>
<dd>Jeffrey Zeldman</dd>
<dd>Ethan Marcotte</dd>
</div>
</dl>

Here's a useful note from Adrian Roselli on screen reader support for description lists.

Via Hacker News

Tags: css, html, screen-readers, web-standards