views:

131

answers:

2

What is the best method to code physical address in html ? in Semantic, Accessible and SEO way

+7  A: 

Use a Microformats vCard

<div class="vcard">
  <span class="fn">Gregory Peck</span>
  <a class="org url" href="http://www.commerce.net/"&gt;CommerceNet&lt;/a&gt;
  <div class="adr">
    <span class="type">Work</span>:
    <div class="street-address">169 University Avenue</div>
    <span class="locality">Palo Alto</span>,  
    <abbr class="region" title="California">CA</abbr>  
    <span class="postal-code">94301</span>
    <div class="country-name">USA</div>
  </div>
  <div class="tel">
   <span class="type">Work</span> +1-650-289-4040
  </div>
  <div class="tel">
    <span class="type">Fax</span> +1-650-289-4041
  </div>
  <div>Email: 
   <span class="email">[email protected]</span>
  </div>
</div>

Accesible: √
Semantic: I guess..
SEO: √ Google announces support for microformats

More examples at http://microformats.org/wiki/hcard-examples
Also check out the Oomph Microformats toolkit that helps you displaying and consuming microformats.

Eduardo Molteni
Do we need to write css for all classes in my CSS file? and in vcard where i can put company name? and what is the benefit of formatting like this ?
metal-gear-solid
You don't need to add all the classes, only the ones that will help you displaying it in a nice way.
Eduardo Molteni
@Jitendra No. Classes are not required to have a specified style.
deceze
I think i will go for id in the onces that are not general.
Colour Blend
+1 it seems best answer till now but i still have some confusion , in vcard where i can put company name? and what is the benefit of formatting like this ?
metal-gear-solid
this code makes us classitis
metal-gear-solid
Use `fn` class in any element for the name, and `org` class for the company. You can put them together if you are showing a company address.
Eduardo Molteni
The benefits: http://microformats.org/wiki/benefits
Jonny Haynes
is there any tool to make this code quickly?
metal-gear-solid
The mentioned Oomph toolkit has a tool to make them quickly
Eduardo Molteni
A: 

<address> is exactly what you are looking for.

http://www.w3.org/TR/html401/struct/global.html#h-7.5.6

Boris Guéry
`address` is **not** exactly what you are looking for. `address` is intended only to mark up contact info regarding the currently viewd page (like the Apache 404 default error pages and the "Apache X.X at ..." line.
Boldewyn
The W3C specifications : >The ADDRESS element may be used by authors to supply contact information for a documentIt is not 'intended only'. I think the most important part is 'supply contact information', and it's what you should want when you provide an address. So it look semanticly correct to use `address` in those cases.
Boris Guéry
from HTML 5 Spec: The ´address´ element must not be used to represent arbitrary addresses (e.g. postal addresses), unless those addresses are in fact the relevant contact information. http://dev.w3.org/html5/spec/Overview.html#the-address-element
Eduardo Molteni