Can Microdata be applied on any type of HTML element? [closed]

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> 

And search engines should know this.

If Google or other search engine services support it can’t be answered definitely, as nothing can be answered with certainty when it comes to third party services that keep their code hidden. Even if they (seem to) support it today, we can’t know what will happen tomorrow. So such questions are usually not appropriate for Stack Overflow.

However, there is no reason to assume that search engines wouldn’t support it.

Leave a Comment