Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it valid to add Microdata attributes (e.g., using the Schema.org vocabulary), such as itemprop="name", to HTML elements that aren’t span or div?

For example:

<h2 class="product_name" itemprop="name">Baseball Glove</h2>
share|improve this question
I do not know, but you can test this with Google Rich Snippet Tools. (I am sure you already know that.) Just create a smaller/simpler test case as not to complicate things too much and see what you get. – closetnoc May 26 '14 at 0:27
Very thorough answer from unor below, but I guess your question is prompted by the fact that Google, Schema.org etc. show examples with noting but <span>s and <div>s - I think they do that to simplify their examples by sidestepping questions of semantic structure and so on that are beside the point for their purposes, it's not an indication that microdata has to be used in that way. – GDav May 26 '14 at 10:38
up vote 2 down vote accepted

Yes, you can use every HTML5 element for Microdata …

Microdata defines 5 new attributes for HTML5:

  • itemid
  • itemprop
  • itemref
  • itemscope
  • itemtype

Let’s see where they can be used. Section 5.2 says:

Every HTML element may have an itemscope attribute specified.

So every element can have itemscope. Further on it says:

Elements with an itemscope attribute may have an itemtype attribute specified

So if it has itemscope (and we learned that every element can have it), it can have itemtype, too. Next:

Elements with an itemscope attribute and an itemtype attribute […] may also have an itemid attribute specified

If it has itemscope and itemtype, it can have itemid, too. And:

Elements with an itemscope attribute may have an itemref attribute specified

If it has itemscope, it can have itemref.

Only itemprop is missing now. It’s defined in Section 5.3:

Every HTML element may have an itemprop attribute specified

So itemprop can also be used on every element.

(Note that Microdata (W3C Note) refers to the HTML5 spec for defining what a "HTML element" is, so essentially "HTML element" means "HTML5 element".)

… but some elements get a different content model (when itemprop is used)

See 8.1 Content models.

For example:

  • href becomes a required attribute for a and area
  • data becomes a required attribute for iframe
  • the attributes name, http-equiv and charset are no longer allowed on meta

… and some elements have special rules for determining the property value (when itemprop is used)

→ See 5.4 Values.

For example:

  • Special rules for links. Here foobar’s value is the URL http://example.com/, not the string Link:

    <a href="http://example.com/" itemprop="foobar">Link</a>
  • Here foobar’s value is 5, not 10:

    <data value="5" itemprop="foobar">10</data> 

(Taken from my answer to a closed question on SO.)

share|improve this answer
Awesome, detailed, and complete answer. Thanks, unor! – nickh May 27 '14 at 2:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.