References

Beginner-friendly references for web development, with live, editable examples.

The HTML itemtype attribute

Global attribute Works on every element All modern browsers
In short

The HTML itemtype attribute specifies the vocabulary URL (usually a schema.org type such as https://schema.org/Product) that defines the available properties of a microdata item. Use it on the same element as itemscope.

Overview

The itemtype attribute names the vocabulary that describes a microdata item. It is set on the element that carries itemscope, and its value is an absolute URL, almost always a schema.org type like https://schema.org/Recipe or https://schema.org/Product.

Once the type is set, the itemprop names you use inside the item should match the properties that type defines, so search engines can interpret them correctly.

Syntax

<div itemscope itemtype="https://schema.org/Product"> … </div>

Values

Value
A valid URL identifying the vocabulary (e.g. https://schema.org/Product).

Example

Live example
<div itemscope itemtype="https://schema.org/Person">
  <span itemprop="name">Ada Lovelace</span>
</div>

Best practices

  • An itemtype can hold several space-separated types, such as two schema.org types, as long as they all come from one vocabulary. Types from two different vocabularies in one itemtype aren't allowed.
  • A nested item that is a different kind of thing, such as a Person inside a Book, needs its own itemtype. Without one, its property names are read against the outer item's types.
  • Copy each type URL exactly as the vocabulary writes it. Item types are opaque identifiers, and user agents must not take an unknown one apart to guess how to process it, so they can't map an altered spelling back to the type you meant.
  • For a property the type doesn't define, use a full absolute URL as the itemprop name, such as itemprop="https://example.com/color", rather than a short word.
  • Read the value from script with getAttribute('itemtype'). Chrome and Firefox have no itemType property on elements, so el.itemType is undefined.

Frequently asked questions

What does the itemtype attribute do?
Specifies the vocabulary the item relates to.
What is HTML microdata?
A way to mark up structured data inline using itemscope, itemprop and related attributes so machines can read it.
Should I use microdata or JSON-LD?
Both work. JSON-LD keeps structured data in one script block and is often easier to maintain; microdata annotates the visible markup directly.
Does a browser fetch the itemtype URL?
No, the standard says itemtype URLs should not be fetched automatically unless the vocabulary's specification allows it. Vocabulary authors are still encouraged to put useful information at the URL.