Menu

HTML5 TUTORIALS - HTML5 Microdata

HTML5 Microdata

ADVERTISEMENTS


<div itemscope>
 <p>My name is <span itemprop="name">Zara</span>.</p>
</div>

<div itemscope>
 <p>My name is <span itemprop="name">Nuha</span>.</p>
</div>

ADVERTISEMENTS

AttributeDescription
itemscopeThis is used to create an item. The itemscope attribute is a boolean attribute that tells that there is Microdata on this page, and this is where it starts.
itemtypeThis attribute is a valid URL which defines the item and provides the context for the properties.
itemidThis attribute is global identifier for the item.
itempropThis attribute defines a property of the item.
itemrefThis attribute gives a list of additional elements to crawl to find the name-value pairs of the item.

ADVERTISEMENTS


<div itemscope>
 <img itemprop="image" src="tp-logo.gif" alt="">
</div>


<div itemscope>
My birthday is:
<time itemprop="birthday" datetime="1971-05-08">
   Aug 5th 1971
</time>
</div>


function supports_microdata_api() {
  return !!document.getItems;
}


<section itemscope itemtype="http://data-vocabulary.org/Person">
<h1 itemprop="name">Andy Runie</h1>
<p>
<img itemprop="photo" src="http://www.example.com/photo.jpg">
</p>
<a itemprop="url" href="http://www.example.com/blog">My Blog</a>
</section>