h-card

(Difference between revisions)

Jump to: navigation, search
(Property Details: complete h-card, clarify use/embed)
m (Example: <img> tag uses "src")
Line 17: Line 17:
<source lang=html4strict>
<source lang=html4strict>
<p class="h-card">
<p class="h-card">
-
   <img class="u-photo" href="http://example.org/photo.png" />
+
   <img class="u-photo" src="http://example.org/photo.png" />
   <a class="p-name u-url" href="http://example.org">Joe Bloggs</a>
   <a class="p-name u-url" href="http://example.org">Joe Bloggs</a>
   <a class="u-email" href="mailto:joebloggs@example.com">joebloggs@example.com</a>
   <a class="u-email" href="mailto:joebloggs@example.com">joebloggs@example.com</a>

Revision as of 02:14, 19 June 2013

Tantek Çelik (Editor)


h-card is a simple, open format for publishing people and organisations on the web. h-card is one of several open microformat draft standards suitable for embedding data in HTML/HTML5.

h-card is the microformats2 update to hCard.

Contents

Example

Here is a simple minimal person example:

<a class="h-card" href="http://example.com">Joe Bloggs</a>

And a slightly more complete example:

<p class="h-card">
  <img class="u-photo" src="http://example.org/photo.png" />
  <a class="p-name u-url" href="http://example.org">Joe Bloggs</a>
  <a class="u-email" href="mailto:joebloggs@example.com">joebloggs@example.com</a>
  <p class="p-adr h-adr">
    <span class="p-street-address">17 Austerstræti</span>
    <span class="p-locality">Reykjavík</span>
    <span class="p-country-name">Iceland</span>
  </p>
</p>

Get started

The class h-card is a root class name that indicates the presence of an h-card.

For minimal examples where at most p-name, u-url and u-photo are required (such as the first given above), only the root class name is needed — see implied properties.

For more complex examples, the root class name must be placed on an element which encloses all the desired properties, and then the properties themselves marked up using the classnames given below.

See microformats-2-parsing to learn more about property classnames.

Properties

h-card properties, inside an element with class h-card:

All properties are optional.

Status

h-card is a microformats.org draft specification. Public discussion on h-card takes place on h-card-feedback, the #microformats irc channel on irc.freenode.net, and microformats-new mailing list.

h-card is ready to use and implemented in the wild, but for backwards compatibility you should also mark h-cards up as classic hCards.

Property Details

(stub, to be expanded)

p-adr can optionally embed an h-adr to cluster associated structured address properties. For example:

<div class="h-card">
  <p class="p-name">Joe Bloggs</p>
  <p class="p-adr h-adr">
    <span class="p-street-address">17 Austerstræti</span>
    <span class="p-locality">Reykjavík</span>
    <span class="p-country-name">Iceland</span>
  </p>
</div>

Reserved properties (not used much, if at all, in practice):

Note: use of 'value' within 'p-tel' should be automatically handled by the support of the value-class-pattern. And for now, the 'type' subproperty of 'tel' is dropped/ignored. If there is demonstrable documented need for additional tel types (e.g. fax), we can introduce new flat properties as needed (e.g. p-tel-fax).

Examples in the wild

Real world in the wild examples:


Validating

Main article: validators

Test and validate your h-adr markup with:


Backward Compatibility

Publisher Compatibility

For backward compatibility, you may wish to use classic hCard classnames in addition to the more future-proof h-card properties, for example:

<p class="h-card vcard">
  <span class="p-name fn">Joe Bloggs</span>,
  <span class="p-org org">Awesome Nonprofit</span>
  ...
</p>

The class vcard is a backward compatible root class name that indicates the presence of an hCard.

fn, org, and all the other backward compatibility hCard property class names are listed below.

Parser Compatibility

Microformats parsers SHOULD detect the following root class name and property names. A microformats2 parser may use existing microformats parsers to extract these properties. If an "h-card" is found, don't look for a "vcard" on the same element.

Compat. root class name: vcard
Properties: (parsed as p- plain text unless otherwise specified)

Reserved: (backward compat properties that parsers MAY implement, if they do, they MUST implement in this way:


Background

This work is based on the existing hCard and vcard specifications.

Design Principles

(stub, expand)

See Also

Categories

h-card was last modified: Wednesday, December 31st, 1969

Views