HTML itemid Attribute

The HTML itemid attribute provides a global identifier for a Microdata item, allowing the item to be identified and related to information about the same item elsewhere.

Global Attribute

The itemid attribute is a global attribute and is part of HTML Microdata. Although global attributes can generally be specified on HTML elements, itemid has additional requirements that determine when it can be used.

itemid Requirements

The itemid attribute can only be specified on an element that also has both the itemscope and itemtype attributes.

<div itemscope
  itemtype="https://schema.org/Book"
  itemid="https://example.com/books/html-guide">
</div>

The vocabulary identified by itemtype must also support global identifiers for that type of item. The meaning of the identifier is determined by the vocabulary being used.

itemid Value

The value of the itemid attribute must be a valid URL. The URL provides the global identifier for the Microdata item.

itemid="https://example.com/books/html-guide"

The identifier does not need to point to a webpage containing the item. Its purpose is to provide an identifier that can distinguish or relate the item according to the rules of the vocabulary being used.

Using itemid with Microdata

The following example describes a book using Microdata. The itemscope attribute creates the item, itemtype identifies its type, and itemid provides its global identifier.

<article itemscope
  itemtype="https://schema.org/Book"
  itemid="https://example.com/books/html-guide">

  <h3 itemprop="name">HTML Guide</h3>
  <p>Author: <span itemprop="author">Jane Smith</span></p>

</article>

The properties marked with itemprop belong to the Microdata item created by itemscope.

The itemid attribute works as part of HTML's group of Microdata attributes.

Attribute Description
itemscope Creates a new Microdata item and defines the scope of its properties.
itemtype Identifies the vocabulary and type associated with the item.
itemid Provides a global identifier for the item.
itemprop Defines a property belonging to an item.
itemref Associates additional properties elsewhere in the document with an item.

Common Mistakes

Do not use itemid without both itemscope and itemtype. The attribute is only valid when those attributes are also present on the same element.

Do not confuse itemid with the HTML id attribute. The id attribute identifies an element within a document, while itemid provides a global identifier for a Microdata item.

Do not assume that every Microdata vocabulary or item type supports a global identifier. Whether itemid is appropriate depends on the vocabulary identified by itemtype.

Browser Support

Baseline: Widely available indicates a feature has been supported by core browsers for at least 30 months. At this stage, the feature is considered stable and safe for most websites to use without needing to worry about compatibility issues or fallbacks, as it is supported by the vast majority of users' devices and browser versions.

The itemid attribute used with HTML microdata is supported in current core browsers. Browser support for microdata attributes is generally separate from whether search engines or other consumers use the structured data.

Checking Browser Support

For current browser compatibility information, visit Can I Use? . Search for the HTML element or attribute you want to check. You can also narrow your search by entering an element name and attribute name separated by a colon. Search results can include related HTML features, element attributes, input types, APIs, and other technologies, so select the result that most closely matches the feature you are checking.

Try the itemid Attribute

The example uses Microdata to describe a book. The itemid attribute provides a global identifier for the item while itemprop identifies individual properties.

Play in Editor

Summary

The HTML itemid attribute provides a global identifier for a Microdata item. It can only be used on an element that also has itemscope and itemtype, and the vocabulary identified by itemtype must support global identifiers. The value of itemid is a URL whose exact meaning is determined by the vocabulary being used.