all

Address Tag

Address Tag

The <address> tag

A few weeks ago, I dove deep into the template tag and it ended up teaching me quite a bit about a tag that has far more uses than I originally suspected. Well, in a recent project, there was an opportunity to provide some address data. And, I wanted to reach for the <address> tag, thinking that was the best way to present postal addresses.

Boy, was I wrong. A quick bit of interwebz searching taught me very quickly that the <address> tag has a very different use. In this spirit, I am going to give you a bit of perspective on it.

For the most broad definition of the <address> tag, I am going to quote MDN.

The HTML <address> element supplies contact information for its nearest <article> or <body> ancestor; in the latter case, it applies to the whole document.

That is far different than how most people use it. I have seen this implementation far too many times:

<address>
  Don Burks<br>
  123 Sesame St.<br>
  New York, NY 21212<br>
  USA
</address>

This would seem to make sense because it is a ‘postal address’. However, as we can see from the mandate explained in the MDN documentation, this is about providing a semantic reference for contact information. The only case, according to the W3C specification, where a postal address is acceptable inside an <address> tag is where the arbitrary address (such as a postal address) is the valid contact information.

Typically, and properly, you’re going to see <address> being used in either an <article> tag to document the contact info asssociated with that article, or in the <footer> tag to document the contact information for the entire page (specifically the content in the <body> tag).