What is microformat
A microformat is a very simple method of reducing the amount of code you have on a page and even more importantly, it means that the user can drag something off a page and directly into anything that supports the microformat code (such as Evolution or Outlook) - this makes a lot of sense - if you have a page with an address on (email, post etc), you can just drag the info from the page to your receiving software
To use microcode within existing code is very simple indeed - just a few basic rules have to be remembered
The rules
- Include
relandrevin href tags.relis a relationship (such as prev and next, withrevbeing a reverse link - Use
classandidwithin code.classcan be considered something that is used a lot within any page (for example<p class="p2">...</p>constructs are used extensively within this site. - Ensure all
idandclassnames are unique. For example, there would be no point in defining aclassandidwith the name example - it breaks the unique identifer rule
The problem with id is that HTML uses them differently in different places.
According to the HTML 4.01 spec, id can be used in 5 different ways (style sheet, anchor point, object reference, element in a script and for just general use when extracting information). Similarly, class has two main use: style sheets and general use (same as id).
Adding microformat to Dublin Core is simple!
Adding the format
Adding the Dublin Core code to a page is simple enough - just remember that you need an (X)HTML tag saying you need it - how it's them put onto a page depends on how you want to access things
Using our example
Let's start off by adding in the DC code
<dl class="dublincore">
Add in the name
<dt>User name</dt> <dd><a href="http://username.foo.clom" class="person">Username</a></dd> </dl>Page 4