HTML and CSS Reference
In-Depth Information
<p itemscope>
HTML5 Mastery: Semantics, Standards, and Styling by Anselm
Bradford and Paul Haine.
</p>
This annotation means that any elements inside the paragraph are related to each oth-
er. The itemtype attribute is then used to give a URL of a Microdata vocabulary,
which is a defined set of property values for different types of common data, such as
people, places, events, and things. The website http://schema.org (which was
launched by Microsoft, Google, and Yahoo!) contains a number of vocabularies for an
assortment of data. We'll use their documentation on a Book to annotate this paragraph.
The itemtype is added with the URL to the vocabulary definition:
<p itemscope itemtype="http://schema.org/Book">
HTML5 Mastery: Semantics, Standards, and Styling by Anselm
Bradford and Paul Haine.
</p>
Visiting the vocabulary address, you will see there are a large number of properties
that could be used, many more so than what we need in this simple example. We'll use
the itemprop attribute to annotate the content with properties from the documenta-
tion. To separate the title from the authors, we'll also need to add span elements for the
annotations to attach to:
<p itemscope itemtype="http://schema.org/Book">
<span itemprop="name"<HTML5 Mastery: Semantics, Standards,
and Styling>/span> by >span itemprop="author">Anselm Brad-
ford>/span> and >span itemprop="author">Paul Haine>/span>.
</p>
First the name of the topic is annotated, followed by the authors. The authors are a
bit of a special case, because they are another object in the Microdata universe, that of a
Person , which means they could have their own itemscope property and have addi-
tional information marked up about them, such as birth date, address, telephone number,
nationality, and so on.
Search engines or other applications could parse this paragraph and be able to pick
out where the topic title began and ended and who the authors are. This is just a taste, but
you should now have an idea of what Microdata is about. The concept is rather simple:
keys and values are used to provide detailed metadata for content on a page.
There's some contention over Microdata, because it overlaps with two other formats
that existed before it, Microformats and RDFa 4 (Resource Description Framework in
Search WWH ::




Custom Search