HTML and CSS Reference
In-Depth Information
The two required attributes in hCard are
fn
and
n
. However, the second one is optional if any
implied āNā
optimization rules
are in effect.
4
The property
n
might have the subproperties
family-name
,
given-name
,
additional-name
,
honorific-prefix
, and
honorific-suffix
.
All other properties are optional, including
adr
,
agent
,
bday
,
category
,
class
,
email
,
geo
,
key
,
label
,
logo
,
mailer
,
nickname
,
note
,
org
,
photo
,
rev
,
role
,
sort-string
,
sound
,
tel2
,
title
,
tz
,
uid
, and
url
. Allowed
subproperties are
post-office-box
,
extended-address
,
street-address
,
locality
,
region
,
postal-code
,
country-name
,
type
, and
value
for
adr
;
type
and
value
for
email
;
latitude
and
longitude
for
geo
;
organization-name
and
organization-unit
for
org
; and
type
and
value
for
tel2
.
A typical hCard code looks like Listing 7-11.
Listing 7-11.
A Typical hCard
<div id="hcard-John-Smith" class="vcard">
<img src="http://www.example.com/jsmith.jpg" alt="Photo of John Smith" class="photo" />
<a class="url fn" href="http://www.example.com">John Smith</a>
<div class="org">Smith and Sons</div>
<a class="email" href="mailto:smith@example.com">smith@example.com</a>
<div class="adr">
<div class="street-address">123 Nice Street</div>
<span class="locality">Vancouver</span>,
<span class="region">BC</span>,
<span class="postal-code">V5K</span>
<span class="country-name">Canada</span>
</div>
<div class="tel">+12345678</div>
</div>
The following hCard elements are singular and can be provided just once:
fn
,
n
,
bday
,
tz
,
geo
,
sort-string
,
uid
,
class
, and
rev
. All other properties are allowed to have multiple instances.
Generally, the visible property values of markup elements represent the value of the hCard property. However,
there are some exceptions.
For hyperlinks that are represented by the
a
element for one or multiple hCard properties, the
href
attribute
provides the property value for all properties with a URL value (for example,
photo
). In case the
img
element is used,
the
src
attribute holds the property value for all properties with a URL value. For
object
elements, the data attribute
provides the property value. The content of the element is the property value for all other properties.
If the
title
attribute is provided for
abbr
elements with hCard notation, its value is considered as the hCard
property instead of the element contents used otherwise.
Although it is easy to create it manually, hCard metadata can be generated by the hCard creator
hCard-o-matic
on the web site of the authors of the specification [38]. You simply fill in a form about the name, organization, country,
e-mail, and other contact data, and the software generates the hCard.
To provide additional information, microformats can also be nested. For example, a sport event review might
contain not only the review but also personal information (hCard) at the same time (Listing 7-12).
4
If
n
is omitted but
fn
is present, the value of
n
will be equal to the value of
fn
.
Search WWH ::
Custom Search