HTML itemprop Attribute

The HTML itemprop attribute adds one or more properties to a Microdata item, allowing information within a webpage to be given machine-readable property names.

Global Attribute

The itemprop attribute is a global attribute and is part of HTML Microdata. It can be specified on HTML elements when the element adds one or more properties to a Microdata item.

How itemprop Works

A Microdata item is created with the itemscope attribute. Elements associated with that item can use itemprop to identify individual properties.

<article itemscope itemtype="https://schema.org/Book">
  <h3 itemprop="name">HTML Guide</h3>
  <p>Author: <span itemprop="author">Jane Smith</span></p>
</article>

In this example, name and author are properties of the book item. The meaning of a property name for a typed item is determined by the vocabulary identified by itemtype.

itemprop Values

The itemprop attribute must contain at least one property name. Its value is an unordered set of unique space-separated tokens, allowing an element to provide more than one property name when appropriate.

itemprop="name"

For a typed Microdata item, a token can be a property name defined by the item's vocabulary or an appropriate URL used as a property name. The vocabulary determines which property names are valid for the item.

Property Values

The value assigned to an itemprop property depends on the HTML element carrying the attribute. For many ordinary elements, the property's value comes from the element's text content.

<span itemprop="author">Jane Smith</span>

Some elements obtain the property value from one of their attributes instead. Common examples include:

Element Property Value
<meta> The content attribute.
<data> The value attribute.
<meter> The value attribute.
<time> The element's datetime value.
<a> The URL from the href attribute.
<img> The URL from the src attribute.
<object> The URL from the data attribute.

If an element carrying itemprop also has an itemscope attribute, the property value is the Microdata item created by that element. This allows Microdata items to be nested.

Multiple Properties

An element can provide more than one property by including multiple unique property names separated by spaces.

<span itemprop="name headline">Learning HTML</span>

Each property receives the value supplied by the element. Property names are case-sensitive and must follow the rules of the Microdata vocabulary being used.

The itemprop attribute works with HTML's other Microdata attributes to describe items and their properties.

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 an item when permitted by its vocabulary.
itemprop Adds one or more properties to an item.
itemref Associates additional properties elsewhere in the document with an item.

Common Mistakes

Do not use an empty itemprop attribute. The attribute must contain at least one property name.

Do not assume that any property name can be used with a typed item. The vocabulary identified by itemtype determines which property names are appropriate.

Do not assume that the visible text of every element becomes the property value. Elements such as <meta>, <data>, <time>, links, and embedded resources can obtain their Microdata values from specific attributes or element-defined values.

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 itemprop 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 itemprop Attribute

The example uses itemprop to identify the name, author, and publication date properties of a book described with Microdata.

Play in Editor

Summary

The HTML itemprop attribute adds properties to a Microdata item. It accepts one or more unique space-separated property names, and the property's value is determined by the element carrying the attribute. For typed items, property names and their meanings are defined by the vocabulary identified with itemtype.