HTML and CSS Reference
Mon-Fri: 12:00 - 22:00
<time itemprop="openingHours" datetime="Sa,Su 11:00-23:00">
Sat-Sun: 11:00 - 23:00
Notice how the openingHours property is used twice in this example.
Ignore that this example is now using multiple <time> elements with datetime attributes for now. You will learn
why this is the case later in this chapter.
The itemid Attribute
The itemid attribute can be used to specify a unique ID for an item. This can then be used by computer programs
to determine whether two microdata items actually refer to the same object. This attribute doesn't really apply to the
restaurant location example we have been working with as the restaurant doesn't have a unique ID so I'm going to
use a different example for the moment.
If I use microdata to mark up information about this topic on my website, and Amazon uses microdata to mark up in-
formation about this topic in its store, and we both used an itemid attribute with the same value, a computer pro-
gram would be able to understand that we are both referring to the same object. The itemid should be a unique
identifier such as a URL or the ISBN of a book.
<div itemscope itemtype="http://schema.org/Book"
<span itemprop="name">HTML5 Foundations</span> by
<span itemprop="author">Matt West</span>.
The “urn” in the itemid attribute here is a Uniform Resource Name. This is similar to a URL but only specifies a
name for identification purposes and not the location of a resource.
The itemref Attribute
There may be times when a property of the item you are defining lies outside the element with the itemscope
defined on it. In these cases, the itemref attribute can be very useful. The itemref attribute can be used to link
properties to your item by using a space-separated list of IDs from HTML elements.