Correct use of the address element

J

JJ

According to the spec (
http://www.w3.org/TR/html401/struct/global.html#h-7.5.6 ), "The ADDRESS
element may be used by authors to supply contact information for a
document or a major part of a document such as a form." Yet I've seen
numerous examples, even in books, of the address element being used to
mark up addresses in the more everyday sense of any brick-and-mortar
location, as in:

<address>
John Smith<br />
1234 Rolling Rock Rd. <br />
Albany, NY, 12345<br />
</address>

(From Pro CSS Techniques, Apress 2006).

So suppose I was creating a "contact us" page which included the
physical address of an organisation - in that case, should the address
element be used? If not, which element would be most appropriate?
 
J

Jukka K. Korpela

Sherm said:
I don't view such usage as contradictory to the spec; it's certainly
contact info, assuming one wants to contact the document authors via
snailmail.

It is certainly contact info, but is it conteact information for the
document (the specific web page) or a major part thereof? Did John Smith
create the document?
I would use it for that, certainly.

At the logical and semantic level, the question is not what type of
information the <address> element contains - it might be a postal address,
an email address, a phone number, or something else - but whose address it
contains. So here the question really is what John Smith has with the page
to do.

On the practical side, why would you use <address> elements in borderline
cases, or at all? If you expect software to pay attention to defined
<address> _semantics_, then the element content should answer the question
"How can I contract the person(s) who created this page or substantially
added to its content?" If you are interested in rendering, then <address> is
more of a problem than a solution, because it is often rendered in italics,
which is an awful idea but mentioned in W3C documents as typical rendering.
This is not serious if you know it - just add
address { font-style: normal; }
plus any special formatting you prefer.

For a postal address other than the author's address, you can use <div> or
<p> (with class, probably). HTML 4 describes <p> as paragraph, and so do the
HTML 5 drafts, but they go wild and described almost any chunk of text that
does not contain block elements as "paragraph". Because a postal address is
not a paragraph in any normal sense, <div> is the HTML 4 way and <p> is the
HTML 5 way. The practical difference is small as long as you remember that
<p> elements have default top and bottom margins, <div> elements don't.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top