Markup for postal addresses

The address element must only be used if this postal address represents the contact information for “its nearest article or body element ancestor”, which, of course, is not the case for all addresses. But if address is used or not, it doesn’t affect the following.

The whole address should be enclosed in a p element, because “an address is also a paragraph”.
As addresses should not be translated, the translate attribute should be set to no.

Each line (except the last one) should be followed by a br element, because the line breaks are meaningful (or “part of the content”, as the HTML5 spec calls it) in addresses.

Each address part (name, street, city, etc.) can be enclosed in a span element. This is not required, but allows the use of semantic annotations.
Abbreviated address parts can be expanded with the abbr element, which can be useful for users not familiar with the address format (e.g., “What means MA?”).

So up to this point, we have:

<p translate="no">
  W3C/MIT<br>
  32 Vassar Street<br>
  Room 32-G515<br>
  Cambridge, <abbr title="Massachusetts">MA</abbr> 02139 USA
</p>

Vocabularies

Schema.org’s PostalAddress type can be used for all address parts except for the room.

The vCard Ontology (which maps vCard to RDF) defines an Address class. There doesn’t seem to be a way to specify the room.

Another Address class is defined in the ISA Programme Location Core Vocabulary. The room can be specified with the locatorName property.

Microformats has h-card (with its p-adr) and h-adr. The room can be specified with p-extended-address.

Using the schema.org vocabulary with RDFa (Lite) as an example:

<p translate="no" typeof="schema:PostalAddress">
  <span property="schema:name">W3C/MIT</span><br>
  <span property="schema:streetAddress">32 Vassar Street</span><br>
  Room 32-G515<br>
  <span property="schema:addressLocality">Cambridge</span>, <abbr title="Massachusetts" property="schema:addressRegion">MA</abbr> <span property="schema:postalCode">02139</span> <abbr property="schema:addressCountry">USA</abbr>
</p>

Leave a Comment