I've been reading up on microformats for my address markup on sites I build, the general consensus is to mark the address up like so...

<h1 class=”org”>Orpheum Theatre</h1>
Madison, WI
<div class=”address”>
    <div class=”adr”>
        <div class=”street-address”>216 State St</div>,
        <span class=”locality”>Madison</span>,
        <span class=”region”>WI</span>
        <span class=”postal-code”> 53703</span>
        <span class=”country”>United States</span>
    </div>
</div> 

What I'm wondering is why the mix and match of div/span tags? does it matter or is the only real important thing the class tags?

Thanks

有帮助吗?

解决方案

You might want to have a look at http://schema.org/. They have a different approach that is supported by major search engines. Also there are links to various testing tools to make sure you get the format right.

其他提示

In that example it could be just to set the street-address to be a block level element without relying on any CSS styling.

Microformats only care about the class names and they can be attached to any element. In the address example you need to ensure they are inside a container with the class of adr

I find this validator very useful - http://hcard.geekhood.net/#result

Markup doesn't matter, only the class names. Most microformat examples are done with divs and spans and blagh. I prefer ul for my hcards. It's easy.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top