Search code examples
htmlmarkupstreet-addressmicrodatamicroformats

Html for Snail Mail Addresses


What do you think is the best way to markup a snail mail address? I found some different options such as:

<div class="address">
<span class="name">Mr. Bob</span><br/>
<span class="street">45654 Bob Ln</span><br/>
<span class="city">Imaginery</span>,<span class="state">OH</span><br/>
<span class="postalCode">44321</span>
</div>

I also saw the previous example using an address tag instead of a div. Another option I found was:

<div class="address">
  <p>Mr. Bob</p>
  <p>45654 Bob Ln</p>
  <p>Imaginery, OH</p>
  <p>44321</p>
</div> 

So my question is what do you think is the best markup to express a snail mail address? And do not limit yourself to my examples.

I feel the first one is the best option, as it provides additional context about each element. I also feel the br is part of the content in this case.


Solution

  • Use the adr microformat:

    http://microformats.org/wiki/adr

    If you also want to mark up the persons name use hCard:

    http://microformats.org/wiki/hcard

    Which includes adr.