Microformats

Microformats

Microformats are a standardised way of assigning class names to common elements in web pages for which no specific HTML elements currently exist. The class names assigned to each element and sub-element identify the content of those elements semantically in the same way that using the correct HTML elements identify what those elements contain semantically.

One example of a microformat so that you can see exactly how it works would be to identify an address. The following shows bith the class that you should assign in identifying that the content is an address as well as all the classes that can be used to define the component parts of an address. This example uses div and span tags which are semantically neutral and which htherefore leave it to the classes that you use and the semantic meanings assigned to those classes by the microformat definition to indicate what the content means semantically.

<div class="adr">
<div class="extended-address">Suite 4</div>
<div class="street-address">14 West Street</div>
<span class="locality">Parramatta</span>,
<span class="region">NSW</span>
<span class="postal-code">2150</span>
<div class="country-name">Australia<div>
</div>

Two things to note about the class names that the microformat uses. Firstly since the actual names usually given to certain component parts of an address can vary from one part of the world to another the developers of the microformat have chosen neutral discriptive names to use for each of the classes. A locality may be a village, town, suburb, or city. A region may be a county, province, or state. A postal code may be a postcode or zip code. The second thing about using the microformat is that as the order in which the component parts of an address can vary depending on where in the world that you are the parts of an address may appear in different orders depending on where in the world that the address is refering to. The classes still identify which part of the address is which in that instance.

There are many other microformats that have been defined for use in helping you to mark up your page content in a more semantic way, I have just used the address microformat as an example since it is one that I would consider to be a good starting point since there is no standard way without it of semantically identifying an address using HTML (The <address> tag is supposed to identify the author of the web page and is not appropriate for addresses other than that of the page author).

The Microformat standards have been released into the public domain and all copyright ownership by the authors of the formats have been relinquished and so everyone can freely use microformats in their HTML markup. More information on microformats can be found at the official web site.

 

This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow
Donate