Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

XHTML how to markup a postal address

Posted on 2009-05-13
7
Medium Priority
?
353 Views
Last Modified: 2013-11-19
Hi experts,
Whats the best way to markup a postal address?
0
Comment
Question by:mstrelan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 16

Expert Comment

by:jessc7
ID: 24381294
If you mean using microformats, I would look at using the hCard format:
http://microformats.org/wiki/hcard

Here is a presentation on the subject:
http://www.xfront.com/microformats/hCard_part5.html

Here is an online hCard creator:
http://microformats.org/code/hcard/creator
0
 
LVL 43

Assisted Solution

by:David S.
David S. earned 200 total points
ID: 24381570
I often use an <address> element and <br />s to add line breaks.
0
 
LVL 10

Author Comment

by:mstrelan
ID: 24381714
@jessc7
I don't know if this is what I'm after

@Kravimir
According to w3schools the <address> element is for the "contact information of the owner or author of the document"
http://www.w3schools.com/TAGS/tag_address.asp

-----

I guess what I'm asking is if there is a more semantic solution than below
<div class="address">
    <span class="address-attention">Mr John Smith</span>
    <span class="address-street">123 Fake Street</span>
    <span class="address-suburb">West End</span>
<!-- etc etc -->
</div>

Open in new window

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 43

Expert Comment

by:David S.
ID: 24381980
I mostly use it on contact pages, so it fits.

hCard would be the most semantic option.
0
 
LVL 16

Accepted Solution

by:
jessc7 earned 800 total points
ID: 24384510
I would recommend looking into hCard, as microformats are becoming more and more useful. Various browsers and plugins are able to intelligently recognize hCard formatted addresses, and interact with them through actions such as using a mapping service or exporting to a vcard to bring in to your e-mail client.

Here is the Wikipedia explanation of microformats:
http://en.wikipedia.org/wiki/Microformats

Here is the Wikipedia explanation of hCard in specific:
http://en.wikipedia.org/wiki/HCard

However using <address> would also suffice as markup and be more semantic than your example, so you could use that as well and still have some meaning behind your XHTML.
<!-- hCard Example -->
<div id="hcard-John-Smith" class="vcard">
 <span class="fn">John Smith</span>
 <div class="adr">
  <div class="street-address">123 Fake Street</div>
  <span class="locality">West End</span>
 </div>
</div>

Open in new window

0
 
LVL 16

Expert Comment

by:jessc7
ID: 24388124
In the example above, I don't believe "John-Smith" would be required for the hCard in the id="hcard-John-Smith" section.

Here is a cheatsheet to help heirarchy and usage:
http://suda.co.uk/projects/microformats/cheatsheet/
0
 
LVL 16

Expert Comment

by:jessc7
ID: 24388249
Here is another example from some work I did on a corporate web site. I stripped out the specific company information. The hCard is picked up by smart browsers/plugs, and could import the information into Outlook, etc.
<address class="vcard">
<a href="http://www.example.com/" class="org url">Company Name<br /></a>
<span class="street-address">1234 Main Street</span><br />
<span class="additional-address">Suite 100</span><br />
<span class="locality">City</span>, <span class="region">State</span> <span class="postal-code">12345</span><br />
Phone: <span class="tel">(555) 555-5555</span><br />
<span class="fn">FirstName LastName</span><br />
<a href="mailto:person@example.com" class="email">person@example.com</a><br />
</address>

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question