Skip to main content

Microformats: More Meaning from Your Markup [HTML & XHTML Tut...

Popularity Report

Total Popularity Score: 0

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Rank

Bookmark History

Saved by 18 people (-4 private), first by anonymouse user on 2007-07-25


Public Sticky notes

Microformats: More Meaning from Your Markup

Highlighted by christoheducamp

Microformats: More Meaning from Your Markup

Highlighted by hanswobbe

on 2008-12-10 by hanswobbe

081209: Found in Christope's set.

Let's have a look at a very simple example, an average blogroll of a list of friends and colleagues:

<li>
<a href="http://suda.co.uk">Brian Suda</a>
</li>

Our first addition to the HTML to create an hCard is to wrap all the data in a class called "vcard":

<li class="vcard">
<a href="http://suda.co.uk">Brian Suda</a>
</li>

"vcard" acts like a container, saying all the data inside this <li> element is data to be considered for this vCard.

Now, I'm sure some people will protest, "Hey, you're abusing the class attribute -- it's only for CSS!" This isn't true. According to the HTML4 spec, the class attribute is a general-purpose attribute for user-agents. Microformats are a perfectly acceptable use for the class attribute; the class attribute does not only apply to CSS.

Highlighted by bibliothecaire