HTML reference

itemref

The Microdata itemref attribute lets an item include properties from elements elsewhere in the same document by referring to their IDs.

What you will learn

  • How itemref points to distant elements
  • How its ID list relates to itemscope
  • When simpler, nested HTML is a better choice

Conceptual example

<article itemscope itemtype="https://schema.org/Product" itemref="price">
  <h2 itemprop="name">Notebook</h2>
</article>

<p id="price" itemprop="price">12</p>

The item points to the element whose id is price. Its itemprop then contributes a property to the item, even though it is not a descendant in the HTML tree.

Use with care

Related pages