HTML itemref Global Attribute
Description
The itemref attribute is part of the Microdata specification in HTML. Microdata is used to provide a way to annotate content with machine-readable metadata, allowing search engines and other tools to better understand the relationships between pieces of data on a webpage.
Purpose
The itemref attribute specifies a list of element IDs that contain additional properties related to a given item. These elements are not necessarily descendants of the element with the itemscope attribute, but they are still logically connected to it.
In simpler terms, itemref lets you point to elements elsewhere in the document that should be treated as part of the same "item" for semantic purposes.
How it Works
- An element with an
itemscopeattribute defines a new item. - Normally, properties of that item are defined using
itempropattributes on elements inside the itemscope. - If some properties are outside the itemscope element,
itemrefcan be used to reference them. - The value of
itemrefis a space-separated list of IDs of elements that contain additional properties.
Syntax
<div itemscope itemtype="https://schema.org/Person" itemref="extra1 extra2">
<span itemprop="name">Alice</span>
</div>
<div id="extra1">
<span itemprop="jobTitle">Engineer</span>
</div>
<div id="extra2">
<span itemprop="email">alice@example.com</span>
</div>
In this example:
- The
<div>withitemscopedefines a Person. itemref="extra1 extra2"tells the browser or parser that the elements with IDsextra1andextra2also contain properties of this Person.- As a result,
jobTitleandemailare associated with the same Person item, even though they are outside the mainitemscopeelement.
Key Points
itemrefdoes not create a new itemscope; it only references properties.- The referenced elements must have unique IDs, as
itemrefuses these IDs to locate them. - Multiple IDs can be listed, separated by spaces.
- Useful when structuring your HTML semantically while keeping your layout flexible (e.g., when properties need to be placed in different parts of the page).
When to Use
- When you want to separate metadata from the main content visually.
- When your page layout prevents nesting all properties within the
itemscope. - When you want to maintain semantic clarity without duplicating content.
Syntax
<div itemscope itemtype="https://schema.org/Person" itemref="extra1 extra2"><span itemprop="name">Alice</span></div>
Values
- itemref
The attribute accepts a string containing one or more unique identifiers.
- Single ID: A single
idvalue (e.g.,itemref="contact-info"). - Multiple IDs: Multiple
idvalues separated by a single space (e.g.,itemref="bio-1 social-links meta-data"). - Case Sensitivity: The IDs must match the
idattributes of the target elements exactly (IDs in HTML are case-sensitive).
- Single ID: A single
Example
Browser Support
The following information will show you the current browser support for the HTML itemref global attribute. Hover over a browser icon to see the version that first introduced support for this HTML global attribute.
This global attribute is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 27th December 2025
