adr-examples: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
m (Fixed markup error in example)
(adding ADDRESS example with appropriate disclaimers)
Line 33: Line 33:
For the full country names in the <code>title</code> attribute of the <code>&lt;abbr&gt;</code> element when using the <em>country-name</em> property,  
For the full country names in the <code>title</code> attribute of the <code>&lt;abbr&gt;</code> element when using the <em>country-name</em> property,  
use [http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html ISO 3166-1].
use [http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html ISO 3166-1].
<h2>Use of the <code>&lt;address&gt;</code> element</h2>
It is possible to use the HTML <code>[http://www.w3.org/MarkUp/html3/address.html &lt;address&gt;]</code> element with <strong>adr</strong>, given the information specifies an address for the current document, such as site contact or business address. <code>&lt;address&gt;</code> should <strong>not</strong> be used for every instance of <strong>adr</strong>. Note: <code>&lt;address&gt;</code> should only contain inline elements.
<h3>Example using ADDRESS:</h3>
<pre><nowiki>
<address class="adr">
<span class="street-address">665 3rd St.</span>
<span class="extended-address">Suite 207</span>
<span class="locality">San Francisco</span>,
<span class="region">CA</span>
<span class="postal-code">94107</span>
<span class="country-name">United States</span>
</address>
</nowiki></pre>

Revision as of 19:26, 26 February 2007

More ADR examples

LOCALITY and other ADR fragments

Using the adr microformat should not just be limited to full datasets of information. In some cases, people reference regions or localities sans any additional information.

By marking these cases up, use of microformats, (particularly adr), will skyrocket.

For instance - with the below post, we reference a city but nothing else. Because I marked up the city name with the locality property, I added the adr property to the block-level parent element that contains the relevant locality property.

Example:

<p class="adr">Unbelievable. Yesterday's high temperature in <span  
class="locality">Salem</span> it was 57 degrees out. </p>

Use of the <abbr> element

Semantically-correct adr markup would use the <abbr> element while using the region, country-name and perhaps other adr properties.

Example:

<abbr class="region" title="California">CA</abbr>,
<abbr class="country-name" title="United States">US</abbr>

For the full country names in the title attribute of the <abbr> element when using the country-name property, use ISO 3166-1.

Use of the <address> element

It is possible to use the HTML <address> element with adr, given the information specifies an address for the current document, such as site contact or business address. <address> should not be used for every instance of adr. Note: <address> should only contain inline elements.

Example using ADDRESS:

<address class="adr">
 <span class="street-address">665 3rd St.</span>
 <span class="extended-address">Suite 207</span>
 <span class="locality">San Francisco</span>,
 <span class="region">CA</span>
 <span class="postal-code">94107</span>
 <span class="country-name">United States</span>
</address>