Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1015715 of itemprop

  • Revision slug: Web/HTML/Global_attributes/itemprop
  • Revision title: itemprop
  • Revision id: 1015715
  • Created:
  • Creator: duncanmcdonald
  • Is current revision? No
  • Comment Bunch of text edits...

Revision Content

Summary

The itemprop attribute is used to add properties to an item. Every HTML element can have an itemprop attribute specified and an itemprop consists of a name-value pair. Each name-value pair is called a property and a group of  one or more properties forms an item. Propertiy values are generally either a string or a URL and can be associated with a very wide range of elements including audio, embed, iframe, img, link, object, source, track, and video.

Simple example

HTML

<div itemscope itemtype ="https://schema.org/Movie">
  <h1 itemprop="name">Avatar</h1>
  <span>Director: <span itemprop="director">James Cameron</span> (born August 16, 1954)</span>
  <span itemprop="genre">Science fiction</span>
  <a href="../movies/avatar-theatrical-trailer.html" itemprop="trailer">Trailer</a>
</div>

 

Structured data

  Item
itemprop name itemprop value
itemprop name Avatar
itemprop director James Cameron
itemprop genre Science fiction
itemprop trailer ../movies/avatar-theatrical-trailer.html

Properties

Properties generally have values that are either a string or a URL. When a string value is a URL, it is expressed using the an element and its href attribute, the img element and its src attribute, or other elements that link to or embed external resources.

Three properties with values that are strings

<div itemscope>
 <p>My name is <span itemprop="name">Neil</span>.</p>
 <p>My band is called <span itemprop="band">Four Parts Water</span>.</p>
 <p>I am <span itemprop="nationality">British</span>.</p>
</div>

One property, "image", whose value is a URL

<div itemscope>
 <img itemprop="image" src="google-logo.png" alt="Google">
</div>

When a string value can't be easily read and understood by a human reader (e.g. a long string of numbers and letters), it can be displayed using the value attribute of the data element, with the more easily-understood-by-a human-version given in the element's contents (which is not part of the structured data - see example below).

An item with a property whose value is a product ID. The ID is not human-friendly, so the product's name is used the human-visible text instead of the ID.

<h1 itemscope>
 <data itemprop="product-id" value="9678AOU879">The Instigator 2000</data>
</h1>

For numeric data, the meter element and its value attribute can be used.

A meter element example

<div itemscope itemtype="https://schema.org/Product">
 <span itemprop="name">Panasonic White 60L Refrigerator</span>
 <img src="panasonic-fridge-60l-white.jpg" alt="">
  <div itemprop="aggregateRating"
       itemscope itemtype="https://schema.org/AggregateRating">
   <meter itemprop="ratingValue" min=0 value=3.5 max=5>Rated 3.5/5</meter>
   (based on <span itemprop="reviewCount">11</span> customer reviews)
  </div>
</div>

Similarly, for date- and time-related data, the time element and its datetime attribute can be used.

In this example, the item has one property, "birthday", whose value is a date

<div itemscope>
 I was born on <time itemprop="birthday" datetime="2009-05-10">May 10th 2009</time>.
</div>

Properties can also be groups of name-value pairs, by putting the itemscope attribute on the element that declares the property. Each value is either a string or a group of name-value pairs (i.e. an item).

In this example, the outer item represents a person, and the inner one represents a band

<div itemscope>
 <p>Name: <span itemprop="name">Amanda</span></p>
 <p>Band: <span itemprop="band" itemscope> <span itemprop="name">Jazz Band</span> (<span itemprop="size">12</span> players)</span></p>
</div>

The outer item above has two properties, "name" and "band". The "name" is "Amanda", and the "band" is an item in its own right, with two properties, "name" and "size". The "name" of the band is "Jazz Band", and the "size" is "12". The outer item in this example is a top-level microdata item. Items that are not part of others are called top-level microdata items.

This example is the same as the previous one, but all the properties are separated from their items

<div itemscope id="amanda" itemref="a b"></div>
<p id="a">Name: <span itemprop="name">Amanda</span></p>
<div id="b" itemprop="band" itemscope itemref="c"></div>
<div id="c">
 <p>Band: <span itemprop="name">Jazz Band</span></p>
 <p>Size: <span itemprop="size">12</span> players</p>
</div>

This gives the same result as the previous example. The first item has two properties, "name", set to "Amanda", and "band", set to another item. That second item has two further properties, "name", set to "Jazz Band", and "size", set to "12".

An item can have multiple properties with the same name and different values.

This example describes an ice cream, with two flavors

<div itemscope>
 <p>Flavors in my favorite ice cream:</p>
 <ul>
  <li itemprop="flavor">Lemon sorbet</li>
  <li itemprop="flavor">Apricot sorbet</li>
 </ul>
</div>

This results in an item with two properties, both with the name "flavor" and having the values "Lemon sorbet" and "Apricot sorbet".

An element introducing a property can also introduce multiple properties at once, to avoid duplication when some of the properties have the same value.

Here we see an item with two properties, "favorite-color" and "favorite-fruit", both set to the value "orange"

<div itemscope>
 <span itemprop="favorite-color favorite-fruit">orange</span>
</div>

Note: There is no relationship between the microdata and the content of the document where the microdata is marked up.

There is no semantic difference between the following two examples

<figure>
 <img src="castle.jpeg">
 <figcaption><span itemscope><span itemprop="name">The Castle</span></span> (1986)</figcaption>
</figure>
<span itemscope><meta itemprop="name" content="The Castle"></span>
<figure>
 <img src="castle.jpeg">
 <figcaption>The Castle (1986)</figcaption>
</figure>

Both have a figure with a caption, and both, completely unrelated to the figure, have an item with a name-value pair with the name "name" and the value "The Castle". The only difference is that if the user drags the figcaption out of the document, the item will be included in the drag-and-drop data. The image associated with the item won't be included.

Names and values

A property is an unordered set of unique tokens that are case-sensitive and represent the name-value pairs. The property value must have at least one token. In the example below, each data cell is a token.

Names examples

  Item
itemprop name itemprop value
itemprop country Ireland
itemprop Option 2
itemprop https://www.flickr.com/photos/nlireland/6992065114/ Ring of Kerry
itemprop img https://www.flickr.com/photos/nlireland/6992065114/
itemprop website flickr
itemprop (token) (token)

Tokens are either strings or URL's. An item is called a typed item if it is a URL, otherwise it is a string. Strings cannot contain a period or a colon (see below).

  1. If the item is a typed item it must be either:
    1. A defined property name, or
    2. A valid URL which is refers to the vocabulary definition, or
    3. A valid URL  that is used as a proprietary item property name (i.e. one not defined in a public specification), or
  2. If the item is not a typed item it must be:
    1. A string that contains no "." (U+002E FULL STOP) characters and no ":" characters (U+003A COLON) and is used as a proprietary item property name (again, one not defined in a public specification).

Note: the rules above disallow ":" characters in non-URL values because otherwise they could not be distinguished from URLs. Values with "." characters are reserved for future extensions. Space characters are disallowed because otherwise the values would be parsed as multiple tokens.

Values

The property value of a name-value pair is as given for the first matching case in the following list:

  • If the element has an itemscope attribute
    • The value is the item created by the element.
  • If the element is a meta element
    • The value is the value of the element's content attribute
  • If the element is an audio, embed, iframe, img, source, track, or video element
    • The value is the resulting URL string that results from parsing the value of the element's src attribute relative to the node document (part of the Microdata DOM API) of the element at the time the attribute is set
  • If the element is an a, area, or link element
    • The value is the resulting URL string that results from parsing the value of the element's href attribute relative to the node document of the element at the time the attribute is set
  • If the element is an object element
    • The value is the resulting URL string that results from parsing the value of the element's data attribute relative to the node document of the element at the time the attribute is set
  • If the element is a data element
    • The value is the value of the element's value attribute
  • If the element is a meter element
    • The value is the value of the element's value attribute
  • If the element is a time element
    • The value is the element's datetime value

Otherwise

  • The value is the element's textContent.

If a property's value is a URL, the property must be specified using a URL property element. The URL property elements are the a, area, audio, embed, iframe, img, link, object, source, track, and video elements.

Name order

Names are unordered relative to each other, but if a particular name has multiple values, they do have a relative order.

In the following example, the "a" property has the values "1" and "2", in that order, but whether the "a" property comes before the "b" property or not is not important

<div itemscope>
 <p itemprop="a">1</p>
 <p itemprop="a">2</p>
 <p itemprop="b">test</p>
</div>

The following is equivalent

<div itemscope>
 <p itemprop="b">test</p>
 <p itemprop="a">1</p>
 <p itemprop="a">2</p>
</div>

As is the following

<div itemscope>
 <p itemprop="a">1</p>
 <p itemprop="b">test</p>
 <p itemprop="a">2</p>
</div>

And the following

<div id="x">
 <p itemprop="a">1</p>
</div>
<div itemscope itemref="x">
 <p itemprop="b">test</p>
 <p itemprop="a">2</p>
</div>

ExampleEdit

HTML

<dl itemscope 
    itemtype="https://vocab.example.net/book" 
    itemid="urn:isbn:0-330-34032-8"
 <dt>Title <dd itemprop="title">The Reality Dysfunction 
 <dt>Author <dd itemprop="author">Peter F. Hamilton 
 <dt>Publication date 
 <dd><time itemprop="pubdate" datetime="1996-01-26">26 January 1996</time> </dl>

Structured data

itemscope itemtype: itemid
https://vocab.example.net/book: urn:isbn:0-330-34032-8
itemprop title The Reality Dysfunction
itemprop author
Peter F. Hamilton
itemprop pubdate 1996-01-26

Result

{{ EmbedLiveSample('HTML_2', '', '', '', 'Web/HTML/Global_attributes/itemprop') }}

SpecificationEditEdit

Specification Status
itemprop WG Note - No longer being actively developed

Revision Source

<h2 id="Summary">Summary</h2>

<p>The <strong>itemprop </strong>attribute is used to add properties to an item. Every <strong>HTML element</strong> can have an itemprop attribute specified and an itemprop consists of a name-value pair. Each name-value pair is called a <strong>property </strong>and a group of&nbsp; one or more properties forms an <strong>item</strong>. Propertiy values are generally either a string or a URL and can be associated with a very wide range of elements including <strong>audio</strong>, <strong>embed</strong>, <strong>iframe</strong>, <strong>img</strong>, <strong>link</strong>, <strong>object</strong>, <strong>source</strong>, <strong>track</strong>, and <strong>video</strong>.</p>

<h3 id="Simple_example">Simple example</h3>

<h4 id="HTML">HTML</h4>

<pre class="brush: html" style="font-family: Courier, monospace; font-size: 14.4px; width: auto; padding: 0px 5px 2px 10px; margin: 0.5em 0px 0px 50px; text-align: left; overflow: auto; color: rgb(58, 73, 86); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; orphans: auto; text-indent: 0px; text-transform: none; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background: rgb(225, 225, 225);">
&lt;div itemscope itemtype ="https://schema.org/Movie"&gt;
  &lt;h1 <strong>itemprop="name"</strong>&gt;Avatar&lt;/h1&gt;
  &lt;span&gt;Director: &lt;span <strong>itemprop="director"</strong>&gt;James Cameron&lt;/span&gt; (born August 16, 1954)&lt;/span&gt;
  &lt;span <strong>itemprop="genre"</strong>&gt;Science fiction&lt;/span&gt;
  &lt;a href="../movies/avatar-theatrical-trailer.html" <strong>itemprop="trailer"</strong>&gt;Trailer&lt;/a&gt;
&lt;/div&gt;</pre>

<p>&nbsp;</p>

<h4 id="Structured_data">Structured data</h4>

<table class="standard-table">
 <tbody>
  <tr>
   <td colspan="1" rowspan="2" style="text-align: center; background-color: rgb(255, 255, 255);">&nbsp;</td>
   <th colspan="2" rowspan="1" style="text-align: center;"><strong>Item</strong></th>
  </tr>
  <tr>
   <th style="text-align: center;"><strong>itemprop name</strong></th>
   <th style="text-align: center;"><strong>itemprop value</strong></th>
  </tr>
  <tr>
   <td>itemprop</td>
   <td>name</td>
   <td>Avatar</td>
  </tr>
  <tr>
   <td>itemprop</td>
   <td>director</td>
   <td>James Cameron</td>
  </tr>
  <tr>
   <td>itemprop</td>
   <td>genre</td>
   <td>Science fiction</td>
  </tr>
  <tr>
   <td>itemprop</td>
   <td>trailer</td>
   <td>../movies/avatar-theatrical-trailer.html</td>
  </tr>
 </tbody>
</table>

<h2 id="Properties">Properties</h2>

<p>Properties generally have values that are either a string or a URL. When a string value is a URL, it is expressed using the an element and its href attribute, the img element and its src attribute, or other elements that link to or embed external resources.</p>

<h4 id="Three_properties_with_values_that_are_strings">Three properties with values that are strings</h4>

<div class="example">
<pre class="brush: html">
&lt;div itemscope&gt;
 &lt;p&gt;My name is &lt;span itemprop="name"&gt;Neil&lt;/span&gt;.&lt;/p&gt;
 &lt;p&gt;My band is called &lt;span itemprop="band"&gt;Four Parts Water&lt;/span&gt;.&lt;/p&gt;
 &lt;p&gt;I am &lt;span itemprop="nationality"&gt;British&lt;/span&gt;.&lt;/p&gt;
&lt;/div&gt;</pre>

<h4 id="One_property_image_whose_value_is_a_URL">One property, "image", whose value is a URL</h4>

<div class="example">
<pre class="brush: html">
&lt;div itemscope&gt;
 &lt;img itemprop="image" src="google-logo.png" alt="Google"&gt;
&lt;/div&gt;</pre>
</div>
</div>

<p>When a string value can't be easily read and understood by a human reader (e.g. a long string of numbers and letters), it can be displayed using the value attribute of the data element, with the more easily-understood-by-a human-version given in the element's contents (which is not part of the structured data - see example below).</p>

<div class="example">
<h4 id="An_item_with_a_property_whose_value_is_a_product_ID._The_ID_is_not_human-friendly_so_the_product's_name_is_used_the_human-visible_text_instead_of_the_ID.">An item with a property whose value is a product ID. The ID is not human-friendly, so the product's name is used the human-visible text instead of the ID.</h4>

<pre class="brush: html">
&lt;h1 itemscope&gt;
 &lt;data itemprop="product-id" value="9678AOU879"&gt;The Instigator 2000&lt;/data&gt;
&lt;/h1&gt;</pre>
</div>

<p>For numeric data, the meter element and its value attribute can be used.</p>

<div class="example">
<h4 id="A_meter_element_example">A meter element example</h4>

<pre class="brush: html">
&lt;div itemscope itemtype="https://schema.org/Product"&gt;
 &lt;span itemprop="name"&gt;Panasonic White 60L Refrigerator&lt;/span&gt;
 &lt;img src="panasonic-fridge-60l-white.jpg" alt=""&gt;
  &lt;div itemprop="aggregateRating"
       itemscope itemtype="https://schema.org/AggregateRating"&gt;
   &lt;meter itemprop="ratingValue" min=0 value=3.5 max=5&gt;Rated 3.5/5&lt;/meter&gt;
   (based on &lt;span itemprop="reviewCount"&gt;11&lt;/span&gt; customer reviews)
  &lt;/div&gt;
&lt;/div&gt;</pre>
</div>

<p>Similarly, for date- and time-related data, the time element and its datetime attribute can be used.</p>

<div class="example">
<h4 id="In_this_example_the_item_has_one_property_birthday_whose_value_is_a_date">In this example, the item has one property, "birthday", whose value is a date</h4>

<pre class="brush: html">
&lt;div itemscope&gt;
 I was born on &lt;time itemprop="birthday" datetime="2009-05-10"&gt;May 10th 2009&lt;/time&gt;.
&lt;/div&gt;</pre>
</div>

<p>Properties can also be groups of name-value pairs, by putting the itemscope attribute on the element that declares the property. Each value is either a string or a group of name-value pairs (i.e. an item).</p>

<div class="example">
<h4 id="In_this_example_the_outer_item_represents_a_person_and_the_inner_one_represents_a_band">In this example, the outer item represents a person, and the inner one represents a band</h4>

<pre class="brush: html">
&lt;div itemscope&gt;
 &lt;p&gt;Name: &lt;span itemprop="name"&gt;Amanda&lt;/span&gt;&lt;/p&gt;
 &lt;p&gt;Band: &lt;span itemprop="band" itemscope&gt; &lt;span itemprop="name"&gt;Jazz Band&lt;/span&gt; (&lt;span itemprop="size"&gt;12&lt;/span&gt; players)&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;</pre>

<p>The outer item above has two properties, "name" and "band". The "name" is "Amanda", and the "band" is an item in its own right, with two properties, "name" and "size". The "name" of the band is "Jazz Band", and the "size" is "12". The outer item in this example is a top-level microdata item. Items that are not part of others are called top-level microdata items.</p>

<div class="example">
<h4 id="This_example_is_the_same_as_the_previous_one_but_all_the_properties_are_separated_from_their_items">This example is the same as the previous one, but all the properties are separated from their items</h4>

<pre class="brush: html">
&lt;div itemscope id="amanda" <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemref">itemref</a>="a b"&gt;&lt;/div&gt;
&lt;p id="a"&gt;Name: &lt;span itemprop="name"&gt;Amanda&lt;/span&gt;&lt;/p&gt;
&lt;div id="b" itemprop="band" itemscope <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemref">itemref</a>="c"&gt;&lt;/div&gt;
&lt;div id="c"&gt;
 &lt;p&gt;Band: &lt;span itemprop="name"&gt;Jazz Band&lt;/span&gt;&lt;/p&gt;
 &lt;p&gt;Size: &lt;span itemprop="size"&gt;12&lt;/span&gt; players&lt;/p&gt;
&lt;/div&gt;</pre>

<p>This gives the same result as the previous example. The first item has two properties, "name", set to "Amanda", and "band", set to another item. That second item has two further properties, "name", set to "Jazz Band", and "size", set to "12".</p>
</div>
</div>

<p>An item can have multiple properties with the same name and different values.</p>

<div class="example">
<h4 id="This_example_describes_an_ice_cream_with_two_flavors">This example describes an ice cream, with two flavors</h4>

<pre class="brush: html">
&lt;div itemscope&gt;
 &lt;p&gt;Flavors in my favorite ice cream:&lt;/p&gt;
 &lt;ul&gt;
  &lt;li itemprop="flavor"&gt;Lemon sorbet&lt;/li&gt;
  &lt;li itemprop="flavor"&gt;Apricot sorbet&lt;/li&gt;
 &lt;/ul&gt;
&lt;/div&gt;</pre>

<p>This results in an item with two properties, both with the name "flavor" and having the values "Lemon sorbet" and "Apricot sorbet".</p>
</div>

<p>An element introducing a property can also introduce multiple properties at once, to avoid duplication when some of the properties have the same value.</p>

<div class="example">
<h4 id="Here_we_see_an_item_with_two_properties_favorite-color_and_favorite-fruit_both_set_to_the_value_orange">Here we see an item with two properties, "favorite-color" and "favorite-fruit", both set to the value "orange"</h4>

<pre class="brush: html">
&lt;div itemscope&gt;
 &lt;span itemprop="favorite-color favorite-fruit"&gt;orange&lt;/span&gt;
&lt;/div&gt;</pre>
</div>

<div class="note">
<p>Note: There is no relationship between the microdata and the content of the document where the microdata is marked up.</p>
</div>

<div class="example">
<h4 id="There_is_no_semantic_difference_between_the_following_two_examples">There is no semantic difference between the following two examples</h4>

<pre class="brush: html">
&lt;figure&gt;
 &lt;img src="castle.jpeg"&gt;
 &lt;figcaption&gt;&lt;span itemscope&gt;&lt;span itemprop="name"&gt;The Castle&lt;/span&gt;&lt;/span&gt; (1986)&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

<pre class="brush: html">
&lt;span itemscope&gt;&lt;meta itemprop="name" content="The Castle"&gt;&lt;/span&gt;
&lt;figure&gt;
 &lt;img src="castle.jpeg"&gt;
 &lt;figcaption&gt;The Castle (1986)&lt;/figcaption&gt;
&lt;/figure&gt;</pre>

<p>Both have a figure with a caption, and both, completely unrelated to the figure, have an item with a name-value pair with the name "name" and the value "The Castle". The only difference is that if the user drags the figcaption out of the document, the item will be included in the drag-and-drop data. The image associated with the item won't be included.</p>
</div>

<h2 id="Names_and_values">Names and values</h2>

<p>A property is an unordered set of unique tokens that are case-sensitive and represent the name-value pairs. The property value must have at least one token. In the example below, each data cell is a token.</p>

<h3 id="Names_examples">Names examples</h3>

<table class="standard-table">
 <thead>
  <tr>
   <th colspan="1" rowspan="2" scope="col" style="text-align: center; background-color: rgb(255, 255, 255);">&nbsp;</th>
   <th colspan="2" rowspan="1" scope="col" style="text-align: center;">Item</th>
  </tr>
  <tr>
   <th scope="col" style="text-align: center;">itemprop&nbsp;<strong>name</strong></th>
   <th scope="col" style="text-align: center;">itemprop&nbsp;<strong>value</strong></th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <th style="text-align: center;">itemprop</th>
   <td style="text-align: center;">country</td>
   <td style="text-align: center;">Ireland</td>
  </tr>
  <tr>
   <th style="text-align: center;">itemprop</th>
   <td style="text-align: center;">Option</td>
   <td style="text-align: center;">2</td>
  </tr>
  <tr>
   <th style="text-align: center;">itemprop</th>
   <td style="text-align: center;">https://www.flickr.com/photos/nlireland/6992065114/</td>
   <td style="text-align: center;">Ring of Kerry</td>
  </tr>
  <tr>
   <th style="text-align: center;">itemprop</th>
   <td style="text-align: center;">img</td>
   <td style="text-align: center;">https://www.flickr.com/photos/nlireland/6992065114/</td>
  </tr>
  <tr>
   <th style="text-align: center;">itemprop</th>
   <td style="text-align: center;">website</td>
   <td style="text-align: center;">flickr</td>
  </tr>
  <tr>
   <th style="text-align: center;">itemprop</th>
   <td style="text-align: center;">(token)</td>
   <td style="text-align: center;">(token)</td>
  </tr>
 </tbody>
</table>

<p><strong>Tokens </strong>are either strings or URL's. An item is called a <strong>typed item</strong> if it is a URL, otherwise it is a string. Strings cannot contain a period or a colon (see below).</p>

<ol>
 <li>If the item is a typed item it must be either:
  <ol>
   <li>A defined property name, or</li>
   <li>A valid URL which is refers to the vocabulary definition, or</li>
   <li>A valid URL&nbsp; that is used as a proprietary item property name (i.e. one not defined in a public specification), or</li>
  </ol>
 </li>
 <li>If the item is not a typed item it must be:
  <ol>
   <li>A string that contains no "<strong>.</strong>" (U+002E FULL STOP) characters and no "<strong>:</strong>" characters (U+003A COLON) and is used as a proprietary item property name (again, one not defined in a public specification).</li>
  </ol>
 </li>
</ol>

<p class="note"><strong>Note:</strong> the rules above disallow ":" characters in non-URL values because otherwise they could not be distinguished from URLs. Values with "." characters are reserved for future extensions. Space characters are disallowed because otherwise the values would be parsed as multiple tokens.</p>

<h2 id="Values">Values</h2>

<p>The property value of a name-value pair is as given for the first matching case in the following list:</p>

<ul>
 <li>If the element has an <strong>itemscope </strong>attribute

  <ul>
   <li>The value is the <strong>item </strong>created by the element.</li>
  </ul>
 </li>
 <li>If the element is a <strong>meta </strong>element
  <ul>
   <li>The value is the value of the element's <strong>content </strong>attribute</li>
  </ul>
 </li>
 <li>If the element is an <strong>audio</strong>, <strong>embed</strong>, <strong>iframe</strong>, <strong>img</strong>, <strong>source</strong>, <strong>track</strong>, or <strong>video </strong>element
  <ul>
   <li>The value is the resulting URL string that results from parsing the value of the element's src attribute relative to the node document (part of the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Microdata_DOM_API">Microdata DOM API</a>) of the element at the time the attribute is set</li>
  </ul>
 </li>
 <li>If the element is an <strong>a</strong>, <strong>area</strong>, or <strong>link </strong>element
  <ul>
   <li>The value is the resulting URL string that results from parsing the value of the element's href attribute relative to the node document of the element at the time the attribute is set</li>
  </ul>
 </li>
 <li>If the element is an <strong>object </strong>element
  <ul>
   <li>The value is the resulting URL string that results from parsing the value of the element's data attribute relative to the node document of the element at the time the attribute is set</li>
  </ul>
 </li>
 <li>If the element is a <strong>data </strong>element
  <ul>
   <li>The value is the value of the element's value attribute</li>
  </ul>
 </li>
 <li>If the element is a <strong>meter </strong>element
  <ul>
   <li>The value is the value of the element's <strong>value </strong>attribute</li>
  </ul>
 </li>
 <li>If the element is a <strong>time </strong>element
  <ul>
   <li>The value is the element's <strong>datetime </strong>value</li>
  </ul>
 </li>
</ul>

<p>Otherwise</p>

<ul>
 <li>The value is the element's <strong>textContent</strong>.</li>
</ul>

<p>If a property's value is a<strong> URL</strong>, the property must be specified using a URL property element. The URL property elements are the <strong>a</strong>, <strong>area</strong>, <strong>audio</strong>, <strong>embed</strong>, <strong>iframe</strong>, <strong>img</strong>, <strong>link</strong>, <strong>object</strong>, <strong>source</strong>, <strong>track</strong>, and <strong>video </strong>elements.</p>

<h3 id="Name_order">Name order</h3>

<p>Names are unordered relative to each other, but if a particular name has multiple values, they do have a relative order.</p>

<div class="example">
<h4 id="In_the_following_example_the_a_property_has_the_values_1_and_2_in_that_order_but_whether_the_a_property_comes_before_the_b_property_or_not_is_not_important">In the following example, the "a" property has the values "1" and "2", <em>in that order</em>, but whether the "a" property comes before the "b" property or not is not important</h4>

<pre class="brush: html">
&lt;div itemscope&gt;
 &lt;p itemprop="a"&gt;1&lt;/p&gt;
 &lt;p itemprop="a"&gt;2&lt;/p&gt;
 &lt;p itemprop="b"&gt;test&lt;/p&gt;
&lt;/div&gt;</pre>

<h4 id="The_following_is_equivalent">The following is equivalent</h4>

<pre class="brush: html">
&lt;div itemscope&gt;
 &lt;p itemprop="b"&gt;test&lt;/p&gt;
 &lt;p itemprop="a"&gt;1&lt;/p&gt;
 &lt;p itemprop="a"&gt;2&lt;/p&gt;
&lt;/div&gt;</pre>

<h4 id="As_is_the_following">As is the following</h4>

<pre class="brush: html">
&lt;div itemscope&gt;
 &lt;p itemprop="a"&gt;1&lt;/p&gt;
 &lt;p itemprop="b"&gt;test&lt;/p&gt;
 &lt;p itemprop="a"&gt;2&lt;/p&gt;
&lt;/div&gt;</pre>

<h4 id="And_the_following">And the following</h4>

<pre class="brush: html">
&lt;div id="x"&gt;
 &lt;p itemprop="a"&gt;1&lt;/p&gt;
&lt;/div&gt;
&lt;div itemscope <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemref">itemref</a>="x"&gt;
 &lt;p itemprop="b"&gt;test&lt;/p&gt;
 &lt;p itemprop="a"&gt;2&lt;/p&gt;
&lt;/div&gt;
</pre>
</div>

<h2 id="ExampleEdit">Example<a class="button section-edit only-icon" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemid$edit#Example"><span>Edit</span></a></h2>

<h3 id="HTML_2">HTML</h3>

<pre class="brush: html">
<code class="language-html"><span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>dl</span> <span class="attr-name token">itemscope</span> 
    <span class="attr-name token">itemtype</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>https://vocab.example.net/book<span class="punctuation token">"</span></span> 
    <span class="attr-name token">itemid</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>urn:isbn:0-330-34032-8<span class="punctuation token">"</span></span>
 <span class="attr-name token">&lt;dt</span><span class="punctuation token">&gt;</span></span>Title <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>dd</span> <span class="attr-name token">itemprop</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>title<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>The Reality Dysfunction 
 <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>dt</span><span class="punctuation token">&gt;</span></span>Author <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>dd</span> <span class="attr-name token">itemprop</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>author<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>Peter F. Hamilton 
 <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>dt</span><span class="punctuation token">&gt;</span></span>Publication date 
 <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>dd</span><span class="punctuation token">&gt;</span></span><span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>time</span> <span class="attr-name token">itemprop</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>pubdate<span class="punctuation token">"</span></span> <span class="attr-name token">datetime</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>1996-01-26<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>26 January 1996<span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>time</span><span class="punctuation token">&gt;</span></span> <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>dl</span><span class="punctuation token">&gt;</span></span>
</code></pre>

<article id="wikiArticle">
<h3 id="Structured_data_2">Structured data</h3>

<table class="standard-table">
 <tbody>
  <tr>
   <td colspan="1" rowspan="14">itemscope</td>
   <td>itemtype: itemid</td>
   <td colspan="2" rowspan="1">
    <div class="jyrRxf-eEDwDf jcd3Mb IZ65Hb-hUbt4d"><span>https://vocab.example.net/book</span>: urn:isbn:0-330-34032-8</div>
   </td>
  </tr>
  <tr>
   <td>itemprop</td>
   <td><span>title</span></td>
   <td><span>The Reality Dysfunction</span></td>
  </tr>
  <tr>
   <td>itemprop</td>
   <td><span>author</span></td>
   <td>
    <div class="jyrRxf-eEDwDf jcd3Mb"><span>Peter F. Hamilton</span></div>
   </td>
  </tr>
  <tr>
   <td>itemprop</td>
   <td><span>pubdate</span></td>
   <td><span>1996-01-26</span></td>
  </tr>
 </tbody>
</table>

<h3 id="Result">Result</h3>

<p>{{ EmbedLiveSample('HTML_2', '', '', '', 'Web/HTML/Global_attributes/itemprop') }}</p>

<h2 id="SpecificationEditEdit">Specification<a class="only-icon button section-edit new" href="https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-alternates$edit#Specifications"><span>Edit</span></a><a class="button section-edit only-icon" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemid$edit#SpecificationsEdit"><span>Edit</span></a></h2>

<table class="standard-table" style="height:105px; width:490px">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td style="text-align: left; vertical-align: middle;"><a class="external external-icon" href="https://html.spec.whatwg.org/multipage/microdata.html#names:-the-itemprop-attribute:names:-the-itemprop-attribute">itemprop</a></td>
   <td style="text-align: left; vertical-align: middle; white-space: nowrap;">WG Note - No longer being actively developed</td>
  </tr>
 </tbody>
</table>
</article>

<div class="share">&nbsp;</div>
Revert to this revision