HTMLs Tutorial

HTML Tutorial HTML Tags HTML Basic Tags HTML Attributes HTML Elements HTML Formatting HTML Text Format HTML body tag HTML samp tag HTML script Tag HTML section tag HTML select tag HTML source tag HTML span tag HTML strike tag HTML strong tag HTML style tag HTML sub tag HTML summary tag HTML sup Tag HTML svg tag HTML table tag HTML u tag HTML Headings HTML Paragraphs HTML wbr tag HTML Anchor HTML Image HTML Lists HTML Ordered List HTML Unordered List HTML Form HTML Form input HTML with CSS HTML Layouts HTML References HTML Frames HTML Links Fieldset Tag in HTML Basic HTML Tags Br Tag in HTML Free HTML Templates How to Create a Table in HTML HTML Calendar HTML Card HTML Cellspacing HTML Center Image HTML Checkbox Read-only HTML Cleaner HTML Code for a Tab HTML Comment HTML Compiler HTML Nested Forms HTML Overlay Text on the Image HTML Select Option Default HTML Snake Game HTML Subheader HTML Tab Character dd Tag in HTML How Many HTML Tags are There HTML Align Tag HTML Responsive HTML Tab Code HTML Table Alternate Row Color HTML Table Fix Column Width Contact HTML DL Tag in HTML How to Insert Image in HTML HTML Background Color HTML Dark Mode How to Convert HTML to PNG HTML Data Toggle HTML Email Template HTML Font Color HTML Font Family ID and Class in HTML HTML Tab Space HTML Tab Tag HTML Itemprop HTML Itemscope HTML Form Design HTML Input Only Numbers HTML Textarea HTML to JPG HTML to Markdown Python li Tag in HTML MDN HTML What is the Correct HTML for Making a Hyperlink? What is the Root Element of an HTML Document How to Make a Box in HTML How to Save HTML Files in Notepad How to Align Text in HTML How to Change Font Color in HTML? How to Change Font Size in HTML How to Change Image Size in HTML How to Create a HTML Page How to Create a Link in HTML File? How to Create an HTML File? HR Tag in HTML HTML Base Tag HTML Default Attribute HTML Hyperlink HTML Indent HTML Injection Payloads HTML Input Numbers Only HTML Roadmap HTML Row Height HTML Schedule HTML Space HTML Tab HTML vs HTTP HTML5 API HTML5 Video HTML Collection to Array Text Area in HTML

HTML5 Advance

HTML5 Tutorial HTML5 Tags HTML Button Tag HTML canvas Tag HTML caption Tag HTML City tag HTML Tag HTML5 SVG HTML Event Attribute HTML5 Audio HTML5 Youtube HTML5 Button Tag HTML5 Tags

Misc

How to add JavaScript to HTML How to change font in HTML How to change text color in HTML HTML Date HTML Hide Element HTML Nested Table HTML Reset Button What does HTML stand for? HTML Background Image HTML Tag Div Tag in HTML How to insert Image in HTML How to create a link with no underline in HTML How to insert spacestabs in text using HTMLCSS HTML tag HTML Code HTML Tag HTML Canvas Design a tribute page using HTML and CSS What is a Container tag Font tag in HTML Difference between HTML and DHTML Empty Tag in HTML HTML Button Link Html Line Break Img src HTML Nested List in HTML Placeholder in HTML TD in HTML HTML Space Code HTML Target Attribute HTML Tag Markup Meaning in HTML Border-Collapse in HTML HTML Onclick Online HTML Compiler Convert HTML to PDF HTML Formatter HTML5 - Web Storage HTTP – Responses Container Tag in HTML DL Tag in HTML Horizontal Rule HTML HTML Tab Text Html Table Cell Background Color HTML Table Cell Color HTML Col Width How Many HTML Tags are There Convert String to Unicode Characters in Python HTML Runner HTML Style Attribute HTML Superscript Attribute HTML tabindex Marquee Tag in HTML HTML Dynamic Form HTML side Tag HTML Pattern Attribute HTML q Tag HTML Readonly Base 64 Encoding in HTML Documents Enhancing Data Portability and Security Evo Cam Web Cam HTML Free code camp HTML CSS How to Add a JS File in HTML? How to Add Picture in HTML How to Add the Logo in HTML? How to Add Video in HTML HTML Class Attribute HTML Entities HTML Form Elements HTML Form Templates HTML Marquee Tag HTML Radio Buttons HTML Text box HTML to JSX HTML Tooltip Basic HTML Codes How to Align Image Center in HTML HTML Header Tag HTML Image Tag HTML Next Line

HTML Itemprop

What is HTML Itemprop?

An item can have properties added by using the itemprop global attribute. A name-value pair makes up an item prop which is an attribute that can be supplied for any HTML element. A set that is composed of one or many key-value pairs is called an item, whereas each pair is referred to as the property. Entity value is related to the very broad spectrum of factors with <audio>, <embed>, <iframe>, <img>, <link>, <object>, <source>, <track>, and <video> being some of those. They can also be either strings or URLs.

Syntax:

<div itemscope itemtype="URL">

   <span itemprop="itemNumber1">name of the item</span>

   <span itemprop="itemNumber2">name of the item</span>

</div>

Examples

The example below displays the source for a group of items identified with item prop attributes, along with a table displaying the produced structured data.

HTML

<div itemscope itemtype="http://schema.org/Movie">

  <h1 itemprop="name">Avatar</h1>

  <span>

    Director:

    <span itemprop="director">James Cameron</span>

    (born August 16, 1954)

  </span>

  <span itemprop="genre">Science fiction</span>

  <a href="../movies/avatar-theatrical-trailer.html" itemprop="trailer">

    Trailer      

  </a>

</div>

Properties

Properties can have values that are strings or URLs. A string value that is a URL can be expressed using other elements that link to or include external resources, such as the <a> element and its href property, the <img> element, and its src attribute, or other components.

Three properties with values that are strings

HTML

<div itemscope>

  <p>My name is <span itemprop="name">Neil</span>.</p>

  <p>My band is called <span itemprop="band">Four Parts Water</span>.</p>

  <p>I am <span itemprop="nationality">British</span>.</p>

</div>

One property, "image", whose value is a URL

HTML

<div itemscope>

  <img itemprop="image" src="google-logo.png" alt="Google" />

</div>

The value attribute of the data element can be used to display a string value that is difficult for a person to read and understand (such as a lengthy string of numbers and letters). The element's contents will then contain the version of the string value that is easier for people to understand.

An item with a property whose value is a product ID

The product name is used in place of the ID since it is more readable by humans.

HTML

<h1 itemscope>

  <data itemprop="product-id" value="9678AOU879">The Instigator 2000</data>

</h1>

The meter element and its value attribute can be used for numerical data.

A meter element

HTML

<div itemscope itemtype="http://schema.org/Product">

  <span itemprop="name">Panasonic White 60L Refrigerator</span>

  <img src="Panasonic-fridge-60l-white.jpg" alt="" />

  <div

    itemprop="aggregate rating"

    item scope

    itemtype="http://schema.org/AggregateRating">

    <meter itemprop="ratingValue" min="0" value="3.5" max="5">

      Rated 3.5/5

    </meter>

    (based on <span itemprop="review count">11</span>

    customer reviews)

  </div>

</div>

Likewise, the time element and its datetime field can be used for date- and time-related data.

An item with one property, "birthday", whose value is a date

HTML

<div itemscope>

  I was born on

  <time itemprop="birthday" datetime="1984-05-10">May 10th 1984</time>.

</div>

With the itemscope attribute applied to the element defining the property, properties can also be collections of name-value pairs. Every value is a collection of name-value pairs (i.e., an item) or a string.

An outer item representing a person, and an inner one representing a band

HTML

<div itemscope>

  <p>Name: <span itemprop="name">Amanda</span></p>

  <p>

    Band:

    <span itemprop="band" itemscope>

      <span itemprop="name">Jazz Band</span>

      (<span itemprop="size">12</span> players)

    </span>

  </p>

</div>

The outer item above presents the two properties "name" and "band". The "band" is a separate entity with the attributes "name" and "size," and the "name" is "Amanda." The band is called "Jazz Band" and is a size twelve. A top-level microdata item is the outer item in this example. Top-level microdata items are those that are not a part of any other series.

All the properties separated from their items

The only difference between this example and the last one is that all properties are now independent of their items.

The outcome is the same as it was in the first example. The "name" property of the first item is set to "Amanda," and the "band" property is set to some other item. Two more characteristics are assigned to that second item: "name," which is set to "Jazz Band," and "size," which is set to "12."

An item can have multiple properties with distinct values and the same name.

HTML

<div itemscope id="amanda" itemref="a b"></div>

<p id="a">Name: <span itemprop="name">Amanda</span></p>

<div id="b" itemprop="band" itemscope itemref="c"></div>

<div id="c">

  <p>Band: <span itemprop="name">Jazz Band</span></p>

  <p>Size: <span itemprop="size">12</span> players</p>

</div>

Ice cream with two flavors

HTML

<div itemscope>

  <p>Flavors in my favorite ice cream:</p>

  <ul>

    <li itemprop="flavor">Lemon sorbet</li>

    <li itemprop="flavor">Apricot sorbet</li>

  </ul>

</div>

This produces a property object with two values, "Lemon sorbet" and "Apricot sorbet," and both with the name "flavor."

If several attributes are introduced by an element simultaneously and some of the properties have the same value, duplication can be avoided by doing so.

An item with two properties, "favorite color" and "favorite fruit", both set to the value "orange."

HTML

<div itemscope>

  <span

    itemprop="favorite-color

    favorite-fruit"

    >orange

  </span>

</div>

The same structured data is marked up in two different ways

The following two examples have no semantic distinction

There is a figure with a caption in each, and there is an item with a name-value pair with the name "name" and the value "The Castle" that is unconnected to the figure. There is only one difference: the item will be added to the drag-and-drop data if the user drags the figcaption out of the document. The item's associated image will not be displayed.

HTML

<figure>

  <img src="castle.jpeg" />

  <figcaption>

    <span itemscope><span itemprop="name">The Castle</span></span> (1986)

  </figcaption>

</figure>

HTML

<span itemscope><meta itemprop="name" content="The Castle" /></span>

<figure>

  <img src="castle.jpeg" />

  <figcaption>The Castle (1986)</figcaption>

</figure>

Names and Values

An unordered collection of distinct tokens that represent name-value pairs and are case-sensitive is called a property. At least one token must be present in the property value. Every data cell is a token in the example below.

Names Examples

 itemprop nameitemprop value
itempropcountryireland
itempropOption2
itemprophttps://www.flickr.com/photos/nlireland/6992065114/Ring of Kerry
itempropimghttps://www.flickr.com/photos/nlireland/6992065114/
itempropwebsiteflickr
itemprop(token)(token)

Strings or URLs can be used as tokens. A URL-based object is referred to as a typed item. If not, it's just a string. A colon or a period cannot be found in a string.

  • If the item is inputted, it needs to be one of the following:
  • A defined property name;
  • A legitimate URL that points to the vocabulary definition; or
  • A legitimate URL used as the name of a proprietary item property (one that's not specified in a public specification) or
  • If the item isn't typed, it needs to be:
  • A string that is used as a proprietary item property name (again, one not declared in a public specification) and has no "." (U+002E FULL STOP) or ":" characters (U+003A COLON).

Values

A name-value pair's property value is as follows for the first matching case in the list below:

  • If an itemscope attribute is present on the element

The thing that the element creates is the value.

  • If the component is a meta-component

The value corresponds to the content attribute value of the element.

  • If the component is a track, video, audio, embed, iframe, image, or source

The value is the URL string produced when the element's src attribute value is parsed about the node document (a component of the Microdata DOM API) when the attribute is set.

  • If the element is an area, a, or link

The value is the URL string that emerges from processing the element's href property value about the element's node document when the attribute is set.

  • If the element is an object element

The value is the URL string that emerges from processing the element's data attribute value about the element's node document when the attribute is set.

  • If the component is a data component

The value is the value assigned to the element's value attribute.

  • If it is a meter element

The value is the value assigned to the element's value attribute.

  • If the element is a temporal component

The value is the datetime value of the element.

Otherwise

  • The text content of the element is its value.

A URL property element must be used to define a property if its value is a URL. The elements that make up the URL property are the a, area, audio, embed, iframe, img, link, object, source, track, and video components.

Name order

While names are not sorted against one another, they are in relative order if a given name has more than one value.

In the example below, the values of "1" and "2" are assigned to the "a" property, but it does not matter if the "a" property comes before the "b" property.

HTML

<div itemscope>

  <p itemprop="a">1</p>

  <p itemprop="a">2</p>

  <p itemprop="b">test</p>

</div>

Here are some similar examples:

HTML

<div itemscope>

  <p itemprop="b">test</p>

  <p itemprop="a">1</p>

  <p itemprop="a">2</p>

</div>

HTML

<div itemscope>

  <p itemprop="a">1</p>

  <p itemprop="b">test</p>

  <p itemprop="a">2</p>

</div>

HTML

<div id="x">

  <p itemprop="a">1</p>

</div>

<div itemscope itemref="x">

  <p itemprop="b">test</p>

  <p itemprop="a">2</p>

</div>

Supported Browsers

Safari

Google Chrome

Microsoft Edge 12 and above

Firefox

Opera