References

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

The HTML itemscope attribute

Global attribute Works on every element All modern browsers Updated
Quick answer

The HTML itemscope attribute marks an element as a microdata item: a group of related name-value pairs. It is a boolean global attribute, almost always paired with itemtype to declare what kind of thing the item is (for example a Product or Person from schema.org).

Overview

Microdata lets you embed machine-readable structured data in ordinary HTML. The itemscope attribute is where an item begins: it declares that the element and its descendants describe a single thing.

On its own itemscope just opens an item; you pair it with itemtype to say what the thing is, add itemprop attributes for each property, and may give it a global id with itemid. Search engines read this data to build rich results. Today many developers prefer JSON-LD for the same job, but microdata remains valid and useful when the data lives in your visible markup.

Syntax

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

Values

Value
itemscope (boolean)

Example

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

Best practices

  • Pair itemscope with an itemtype so the item has a defined vocabulary.
  • Nest itemscope items to describe complex, related data.
  • Validate your markup with Google's Rich Results Test.
  • Consider JSON-LD as an alternative when the data is not part of the visible content.

Accessibility

Microdata attributes are metadata for machines — they do not change how an element looks or how it is announced by assistive technology. Adding itemscope has no effect on the user-facing experience.

Frequently asked questions

What is the itemscope attribute?
It marks an element as a microdata item — a grouped set of properties describing one thing.
What is the difference between itemscope and itemtype?
itemscope starts the item; itemtype says what type of thing it is, using a vocabulary URL such as https://schema.org/Product.
Is microdata still used?
Yes, it is valid HTML and understood by search engines, though JSON-LD is now the more popular way to add structured data.
Does microdata help SEO?
It can. Structured data helps search engines understand your content and can qualify pages for rich results.