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
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 andform where it starts.
-
itemid - This attribute is basically a global identifier for an item.
itemprop - This attribute is used to add or define a property in an item.
itemref - This attribute gives additional elements to crawl to find the property of the item.
itemtype - This 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
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
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 .