适当使用DL和DD吗?
我最近有一些为我设计的网站模板。 我得到了最终的 HTML 代码,该代码已验证,但文档的结构是使用 DL-DD 对进行布局的:
<dl>
<dd class="some-class">
Some text.
</dd>
</dl>
我对这些标签不是特别熟悉,因为我从未经常使用它们,但它们似乎并不是有意的用于文档结构。 我对吗? 设计师为什么要这么做?
I had some site templates designed for me recently. I got the final HTML code, which validates, but the structure of the document is laid out using DL-DD pairs:
<dl>
<dd class="some-class">
Some text.
</dd>
</dl>
I'm not especially familiar with those tags as I've never used them much, but they don't seem intended for document structure. Am I right? Why would a designer do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
来自 WC3:http://www.w3.org/TR /html401/struct/lists.html#h-10.3
因此,根据您的示例,这些类型的结构应用于特定类型的内容,而不是构建不适合此上下文的数据。
From WC3: http://www.w3.org/TR/html401/struct/lists.html#h-10.3
So given your example, these types of structures should be used for a specific type of content and not structuring of data that does not fit within this context.
你是对的,不应该这样使用它。 我能想到的设计者使用它们的唯一原因是
标签在大多数浏览器中都是缩进的。 如果它们覆盖了它们的填充/边距,那么您的猜测和我的一样好。
You're right in that it shouldn't be used like that. The only reason I can think of for the designer using them is that the
<dd>
tag is indented in most browsers. If they're overriding the padding/margins on them, then your guess is as good as mine.DL
标签与UL
标签大致相同,它启动一个无序列表。不同之处在于,
DL
/DD
对中基本上没有项目符号。但大多数时候,它用于实际用途,即D定义列表,并与
DT
和DD
,即Definition Term和Definition Description,它们将看起来像 :默认情况下,该术语会缩进一点,并进一步缩进它的定义。
A
DL
tag is about the same as aUL
tag, it starts an unordered list.The difference being that there basically is no bullet in a
DL
/DD
couple.Most of the time, though, it's used for it's real use, that is, a Definition List, and is used with
DT
andDD
, which are Definition Term and Definition Description which would look like :which will, by default, indent the term a bit, and indent it's definition a bit more.