HTML itemscope Global Attribute
Description
The itemscope attribute is a global HTML attribute used to define the scope of a microdata item. Microdata is a way to embed structured data within HTML documents, allowing search engines, web crawlers, and other tools to better understand the content of your page.
When you add itemscope to an HTML element, it indicates that the element represents a single item with properties, which can then be described using other microdata attributes like itemprop and itemtype.
How It Works
Declaring an item: Adding
itemscopeto an element marks it as a container for a microdata item. It tells browsers and search engines that this element has properties that can be enumerated.Optional
itemtype: Often,itemscopeis combined withitemtypeto specify the type of item (using a URL that defines a vocabulary, usually from Schema.org). This gives semantic meaning to the data.Child properties: Elements inside an
itemscopeelement can have theitempropattribute, defining properties of that item. These child elements are considered part of the scope of the item.
Syntax
<!-- Basic itemscope usage -->
<div itemscope>
<span itemprop="name">Sample Item</span>
<span itemprop="description">This is a description of the item.</span>
</div>
<!-- Using itemscope with itemtype -->
<div itemscope itemtype="https://schema.org/Product">
<span itemprop="name">Chocolate Bar</span>
<span itemprop="brand">Sweet Co.</span>
<span itemprop="price">$2.50</span>
</div>
Key Points
Global attribute:
itemscopecan be used on almost any HTML element because it is global.Boolean attribute: It does not require a value; just including it is enough. Example:
<div itemscope>.Creates a microdata scope: Only child elements within the
itemscopecontainer withitempropattributes are considered part of the item.Works with
itemtypeanditemid:itemtype: Specifies the type of item.itemid: Provides a unique identifier for the item.
Supports nested items: You can have
itemscopeelements inside otheritemscopeelements to represent hierarchical data.
Example of Nested Items
<div itemscope itemtype="https://schema.org/Person">
<span itemprop="name">John Doe</span>
<div itemscope itemprop="address" itemtype="https://schema.org/PostalAddress">
<span itemprop="streetAddress">123 Main St</span>
<span itemprop="addressLocality">Springfield</span>
<span itemprop="postalCode">12345</span>
</div>
</div>
- Here, the
addressproperty of thePersonitem is itself a nested microdata item.
Syntax
<div itemscope itemtype="https://schema.org/Person"><span itemprop="name">Jane Doe</span></div>
Values
- itemscope
Because
itemscopeis a boolean attribute, it doesn't have a list of "values" in the traditional sense (like thetypeattribute for an input). However, there are three valid ways to write it in your HTML:Syntax Type Code Example Note Short / Preferred <div itemscope>The most common and modern way to write it. Empty String <div itemscope="">Valid, but rarely used. Attribute Name <div itemscope="itemscope">Common in XHTML or legacy systems that require value pairs.
Example
Browser Support
The following information will show you the current browser support for the HTML itemscope 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
