Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
302 views
in Technique[技术] by (71.8m points)

html - Don't use <address> for address

Here is what the HTML5 spec says:

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

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>?

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 …

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Hum... when you quote the specs, don't remove the relevant parts (emphasis is mine):

The address element represents the contact information for its nearest article or body element ancestor.

The address element must not be used to represent arbitrary addresses (e.g. postal addresses), unless those addresses are in fact the relevant contact information.

As I understand this :

The address element must not be used to represent arbitrary addresses (e.g. postal addresses), unless those addresses are in fact the relevant contact information for the nearest article or body element ancestor.

Is it still unclear ?

Regarding company address in footer : it is ok to use the <address> tag if the nearest article or body element ancestor is about the company.

You must use the <p> tag for addresses that are not related to the nearest article or body element ancestor.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...