不要使用< address>地址 [英] Don't use <address> for address

查看:105
本文介绍了不要使用< address>地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是 HTML5规范所说的内容:



  1. 地址元素代表联系信息[ ...]

  2. 地址元素不得用于表示任意地址[...]

  1. The address element represents the contact information […]
  2. The address element must not be used to represent arbitrary addresses […]


不是很荒谬吗?他们说不要使用< address> 作为地址。他们为什么会命名该元素地址呢?也许他们必须将它命名为< contacts>

Isn't it ridiculous? They say "Don't use <address> for address". Why would they name that element address then? Maybe they had to name it <contacts>?

他们说: p 元素是一般用于标记邮政地址的适当元素,但嘿,< p> 元素适用于任何事情。它可以是一个小说...

They say: "The p element is the appropriate element for marking up postal addresses in general" but hey, the <p> element is appropriate for anything then. It can be a piece of novel …

如果你想标记公司邮寄地址在他们的网站的页脚,你使用什么?只需< p> ?我不认为这是一个段落,是吗?

If you want to markup a company postal address in their site's footer what do you use? Just <p>? I don't think it's a paragraph there, do you?

推荐答案

邮政地址的基本标记 p 元素, br 元素分隔行。

The basic markup for postal addresses is a p element with br elements for separating the lines.

address 元素传达了其他信息,即这个邮政地址是文章(如果有的话)或正文的联系信息的(部分)(如果有没有父母文章)。

The address element conveys additional information, namely, that this postal address is (part of) the contact information for an article (if there is one) or the body (if there is no parent article).

因此,在这两种情况下,您应该为邮政地址设置相同的标记,或者使用或者没有地址容器(取决于邮政地址的目的)。

So in both cases you should have the same markup for postal addresses, either with or without address container (depending on the purpose of the postal address).

在您的具体示例中(公司地址在公司网站的页脚),您应该使用地址元素,因为您的公司是该网页的相关联系人。请注意,此地址还可能包含贵公司的电子邮件地址,电话号码等。

In your specific example (company address in the footer of the company’s website), you should use the address element, because your company is the relevant contact for the webpage. Note that this address could also contain your company’s email address, telephone number etc.

可能因为元素名称是从以前的非HTML规范中被采用的(也许它的目的/含义在某些讨论HTML的时候被重新定义)。
HTML的早期历史它在1990年以前:GMLguide和GML部分中说滑铁卢SCRIPT GML用户指南(SGML的某种前身)从1988年开始提到了现在在HTML中使用的几个标签,其中包括 ADDRESS

Probably because the element name was adopted from previous non-HTML specifications (and maybe its purpose/meaning was redefined at some point discussing HTML).
On Early History of HTML it says in the "Pre-1990: GMLguide and GML" section that the "Waterloo SCRIPT GML User's Guide" (some kind of predecessor to SGML) from 1988 mentions several tags that are now used in HTML, too, and among them is ADDRESS.

但它没有'真的很重要。尽管描述性元素名称很有用,但它们不是必需的。语义由HTML规范定义,而不是由元素名称定义。

But it doesn’t really matter. While descriptive element names are helpful, they are not required. The semantics are defined by the HTML specification, not by the element names.

查看各种HTML版本,我们可以看到它从未打算用于 every 种邮递地址:

Looking at the various HTML versions, we can see that it was never intended to be used for every kind of postal address:

  • address in HTML5.1 (draft): "contact information"
  • address in HTML5: "contact information"
  • address in HTML 4.01: "contact information"
  • address in HTML 4.0: "contact information"
  • address in HTML 3.2: "authorship and contact details"
  • address in HTML 3.0 (draft): "address, signature and authorship"
  • address in HTML 2.0: "address, signature and authorship"
  • address in the first HTML draft: "address information, signatures, etc"

这篇关于不要使用&lt; address&gt;地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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