Skip to content

itemref - Reference External Properties

Global Attribute HTML5

The itemref attribute allows you to reference Microdata properties that are not contained within an element with the itemscope attribute. This is useful when properties of an item are scattered across different parts of your HTML document rather than being nested together.

Result
<element itemscope itemref="id-reference">Content</element>
<element itemscope itemref="id1 id2 id3">Content</element>
ValueDescription
id-referenceA space-separated list of element IDs that contain additional itemprop properties for this item.

The itemref attribute is valuable when:

Properties are scattered across the DOM: Your page structure requires item properties to be in different locations for layout or design reasons.

Shared metadata exists: Multiple items share common properties that are defined once in the document.

Separation of concerns is needed: Content is organized semantically in your HTML, but needs to be grouped differently for structured data purposes.

Result
Result
Result

For itemref to work correctly:

  1. The element must have itemscope: The itemref attribute is only valid on elements that define an item scope.

  2. Referenced elements must exist: Each ID in the itemref value must correspond to an element in the document.

  3. Referenced elements contain itemprop: The referenced elements (or their descendants) should have itemprop attributes that define properties for the item.

<!-- The item with itemscope and itemref -->
<div itemscope itemtype="http://schema.org/Movie" itemref="director cast">
<h1 itemprop="name">The Matrix</h1>
<span itemprop="datePublished">1999</span>
</div>
<!-- Referenced element with additional properties -->
<div id="director">
<span itemprop="director" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">Lana Wachowski</span>
</span>
</div>
<!-- Another referenced element -->
<div id="cast">
<span itemprop="actor" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">Keanu Reeves</span>
</span>
</div>

You can reference multiple elements by separating their IDs with spaces:

Result

Only use itemref when your document structure genuinely requires properties to be separate. Prefer nesting properties within the itemscope element when possible:

<!-- Preferred: nested structure -->
<div itemscope itemtype="http://schema.org/Person">
<span itemprop="name">Jane Doe</span>
<span itemprop="email">[email protected]</span>
</div>
<!-- Use itemref only when structure demands it -->
<div itemscope itemtype="http://schema.org/Person" itemref="contact">
<span itemprop="name">Jane Doe</span>
</div>
<footer id="contact">
<span itemprop="email">[email protected]</span>
</footer>

Since itemref relies on ID references, make sure each ID is unique in the document:

<!-- Correct -->
<div itemscope itemref="bio-1">...</div>
<div id="bio-1">...</div>
<div itemscope itemref="bio-2">...</div>
<div id="bio-2">...</div>

When using itemref, add comments to explain the relationship between elements:

<!-- Product item references warranty and shipping info -->
<div itemscope itemtype="http://schema.org/Product"
itemref="warranty shipping">
<h2 itemprop="name">Laptop Computer</h2>
</div>
<!-- Warranty information (referenced by itemref) -->
<div id="warranty">
<meta itemprop="warranty" content="2 years">
</div>
<!-- Shipping information (referenced by itemref) -->
<div id="shipping">
<meta itemprop="shippingDetails" content="Free shipping">
</div>

The itemref attribute is part of the HTML5 Microdata specification and is supported by all modern browsers. However, Microdata extraction and processing is primarily done by search engines and other automated tools rather than browsers directly.

BrowserSupport
ChromeYes (HTML5 Microdata)
FirefoxYes (HTML5 Microdata)
SafariYes (HTML5 Microdata)
EdgeYes (HTML5 Microdata)

itemscope

Defines an item scope for Microdata. Required for using itemref.

itemtype

Specifies the vocabulary URL that defines the item’s properties.

itemprop

Defines a property of an item within an itemscope.

itemid

Provides a unique identifier for an item within a vocabulary.