Search code examples
htmlw3csemantic-markupstreet-address

What is the most semantic way to display a street address in HTML?


I have an address that is going to be displayed on a webpage, but it is not the address for the author of the page. How should this be coded to be semantic given the w3c recommendation of:

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. This element often appears at the beginning or end of a document.


Solution

  • You could use the hCard Microformat to describe your address. The advantage of Microformats is that you can use them in your existing documents to enrich them.

    Here’s an example derived from the example from the Microformats wiki:

    <address class="vcard">
      <span class="adr">
        <span class="street-address">169 University Avenue</span>
        <span class="locality">Palo Alto</span>,  
        <abbr class="region" title="California">CA</abbr>&nbsp;&nbsp;
        <span class="postal-code">94301</span>
        <span class="country-name">USA</span>
      </span>
    </address>