什么是< dl>标签为? [英] What's the <dl> tag for?

查看:156
本文介绍了什么是< dl>标签为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用< dl>,< dt>和< dd>标签而不是嵌套的CSS样式< ul>和< ol>标签?或者他们只是一个过时的标签组,等待被弃用? 解决方案

引用 W3C规范


dl元素表示由零个或多个名称 - 值组(描述列表)组成的关联列表。每个组必须包含一个或多个名称(dt元素),后跟一个或多个值(dd元素)。在单个dl元素中,每个名称不应该有多个dt元素。


所以<$ $的主要原因c $ c>< dl> ,< dt> < dd> 标记是为了保留这些名称 - 值对的语义连接,如果您只是使用嵌套列表,它们将会丢失。



如果使用嵌套列表,由于各种原因(目前,例如,许多菜单被构建为嵌套列表)以及爬行程序或任何其他系统(基于语义标注),都无法区分它们。



但是,如果您使用上述标签,则系统可以看到该连接并采取相应措施。因此,未来的用法可能是在更大的文档中提取所有术语的定义以创建某种术语表。


Is there any logical reason for using the <dl>, <dt> and <dd> tags instead of nested, CSS-styled <ul> and <ol> tags? Or are they just an outdated group of tags waiting to be deprecated?

解决方案

Citing the W3C spec:

The dl element represents an association list consisting of zero or more name-value groups (a description list). Each group must consist of one or more names (dt elements) followed by one or more values (dd elements). Within a single dl element, there should not be more than one dt element for each name.

So the main reason for the <dl>, <dt> and <dd> tags are to preserve the semantic connection for those name-value pairs, which would get lost, if you just used nested lists.

If you use nested lists, this could be done for various reasons (currently, e.g., many menus are structured into nested lists) and crawlers or any other system, that respects semantic annotations, would not be able to tell the difference.

If you use the above tags, however, a system can see the connection and act accordingly. So a future use maybe to extract all definitions of terms inside a larger document to create some kind of glossary.

这篇关于什么是&lt; dl&gt;标签为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆