# The “itemtype” attribute must not be specified on elements that do not have an “itemscope” attribute specified.

> Canonical HTML version: https://rocketvalidator.com/html-validation/the-itemtype-attribute-must-not-be-specified-on-elements-that-do-not-have-an-itemscope-attribute-specified
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `itemtype` and `itemscope` attributes are part of the HTML Microdata specification, which allows you to embed structured, machine-readable data into your HTML. The `itemscope` attribute creates a new item — it defines a scope within which properties (via `itemprop`) are associated. The `itemtype` attribute then specifies a vocabulary URL (typically from [Schema.org](https://schema.org/)) that describes what kind of item it is.

According to the WHATWG HTML Living Standard, `itemtype` has no meaning without `itemscope`. The `itemscope` attribute is what establishes the element as a microdata item container. Without it, `itemtype` has nothing to qualify — there is no item to assign a type to. This is why the spec requires `itemscope` to be present whenever `itemtype` is used.

Getting this wrong matters for several reasons:

- **Structured data won't work.** Search engines like Google rely on valid microdata to generate rich results (e.g., star ratings, event details, product prices). Invalid markup means your structured data will be silently ignored.
- **Standards compliance.** Using `itemtype` without `itemscope` violates the HTML specification, and validators will flag it as an error.
- **Maintainability.** Other developers (or your future self) may assume the microdata is functioning correctly when it isn't.

To fix this issue, you have two options:

1. **Add `itemscope` to the element** — this is the correct fix if you intend to use microdata.
2. **Remove `itemtype`** — this is appropriate if you don't actually need structured data on that element.

## Examples

### Incorrect — `itemtype` without `itemscope`

This triggers the validation error because `itemscope` is missing:

```html
<div itemtype="https://schema.org/Person">
  <p><span itemprop="name">Liza Jane</span></p>
  <p><span itemprop="email">liza.jane@example.com</span></p>
</div>
```

### Correct — adding `itemscope` alongside `itemtype`

Adding the `itemscope` attribute establishes the element as a microdata item, making `itemtype` valid:

```html
<div itemscope itemtype="https://schema.org/Person">
  <p><span itemprop="name">Liza Jane</span></p>
  <p><span itemprop="email">liza.jane@example.com</span></p>
</div>
```

Here, `itemscope` tells parsers that this `div` contains a microdata item, and `itemtype="https://schema.org/Person"` specifies that the item is a Person with properties like `name` and `email`.

### Correct — removing `itemtype` when structured data isn't needed

If you don't need typed structured data, simply remove the `itemtype` attribute. You can still use `itemscope` on its own to create an untyped item, or remove both attributes entirely:

```html
<div>
  <p><span>Liza Jane</span></p>
  <p><span>liza.jane@example.com</span></p>
</div>
```

### Correct — nested items with `itemscope` and `itemtype`

When nesting microdata items, each level that uses `itemtype` must also have `itemscope`:

```html
<div itemscope itemtype="https://schema.org/Organization">
  <span itemprop="name">Acme Corp</span>
  <div itemprop="founder" itemscope itemtype="https://schema.org/Person">
    <span itemprop="name">Liza Jane</span>
  </div>
</div>
```

Notice that both the outer `div` (the Organization) and the inner `div` (the Person) have `itemscope` paired with their respective `itemtype` values. Omitting `itemscope` from either element would trigger the validation error.
