Microdata A Standardized Way To Provide Additional Semantics

Posted By : Sachin Arora | 28-Mar-2018

Microdata is basically a standardized way to provide some additional semantics in our web pages or we can say a specification used to nest metadata within existing content in web pages. The search engines, browsers, and web-crawlers can extract and process this microdata from web pages to provide a richer user experience.

Microdata gives the us power to define our own customizable elements and also the power to embed our custom properties in our web pages.A microdata consists of a group of name-value pairs. These groups are 
referred
as items and this name-value pair is called a  property, these groups(items) and properties are represented by regular elements.  
 

  • To create an item in microdata we use itemscope attribute.
     
  • To add these name-value pair or a property in an item, an attribute  itemdrop is used on one of the item's descendants.

     

Example: Showing two items, each having a property 'name'

 

<html>
   <body>
      
      <div itemscope>
         <p>My name is <span itemprop="name">Sachin</span>.</p>
      </div>
      
      <div itemscope>
         <p>My name is <span itemprop="name">Rahul</span>.</p>
      </div>
      
   </body>
</html>

 

The above example will give the following result:

      My name is Sachin.

      My name is Rahul.

 

Global Attributes
 

 

Micro data introduced five global attributes which are available for any element to use and can give context to machines about our data.

  1. itemscope   - This attribute is used to create an item and it is a boolean attribute which tells that there is a microdata on this page and form where it starts.
     
  2.  itemidThis attribute is basically a global identifier for an item.
     
  3. itempropThis attribute is used to add or define a property in an item.
     
  4. itemrefThis attribute gives additional elements to crawl to find the property of the item.
     
  5. itemtypeThis attribute is a URL which provides the context for the properties and defines the item

Example:

 

<html>
   <body>
      
      <div itemscope>
         My birthday is:
         
         <time itemprop="birthday" datetime="1971-05-08">
            Feb 01, 1995
         </time>
         
      </div>
      
   </body>
</html>

 

 

The result of the following example : - 
 

My birthday is: Feb 01, 1995

 

 

 

About Author

Author Image
Sachin Arora

Sachin is ambitious and hardworking individual with broad skills,He have the capabilities to build captivating UI applications . One of his key strength is building a strong bond with the team in order to deliver the best results on time .

Request for Proposal

Name is required

Comment is required

Sending message..