HTML and CSS Reference
In-Depth Information
In addition, HTML5 allows for custom data attributes , which further give web
professionals a standards-compliant way for embedding additional data in their
markup.
The markup aspects of these features work in browsers today, but the associated DOM
APIs to interact with them are not yet (microdata) or widely (custom data) supported
by user agents. Still, given that it is possible to write JavaScript to interact with the
additional data, there's little reason not to use them.
When to Use Microdata Versus Custom Data
Similar to microformats and RDFa, microdata is used to mark up structured data. It
introduces new attributes that can be applied to any element in order to identify scoped
name/value pairs. As with microformats, shared vocabularies are emerging to
standardize how data is marked up, so microdata can be used to share data across
websites and applications.
Custom data attributes are just that: custom . You, the programmer, create attributes
using the data- prefix and assign them values. The name/value pairs are related to the
displayed content, but are not themselves displayed. Because you define the attributes
according to the needs of your website or application, these are not to be used to
exchange data with another site, nor do public search engines consume them.
Should you use microdata or RDFa for your structured data? Ongoing
W3C discussions about whether or not two overlapping standards
should exist have some concerned about the future of these specifica-
tions. Google, Microsoft, and Yahoo!, meanwhile, are promoting
microdata and have teamed up to create Schema.org , a shared vocabu-
lary of data structures that allows their search engines to extract more
meaning from your data.
For an excellent comparison of microdata, RDFa, and microformats,
read Manu Sporny's detailed analysis at http://manu.sporny.org/2011/
uber-comparison-rdfa-md-uf/ .
6.1 Adding Microdata to Markup
Problem
You want to add microdata to convey additional meaning or semantics about your
content so that machine-parsing tools can access this information.
 
Search WWH ::




Custom Search