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 Itemscope

Introduction

The global attribute item scope, which is boolean, establishes the extent of related metadata. When its itemscope attribute is specified, an element can have several name-value pairs associated with it, creating a new item.

A vocabulary (like schema.org) describes the item and its properties context. It can be found at the valid URL specified by the related attribute itemtype. All of the language used in the following examples is taken from schema.org.

An itemscope property can be specified for any HTML element. If an itemscope element doesn't have a corresponding item type, it needs to have an associated itemref.

The HTML itemscope property collaborates with item types to ensure that the HTML in a block is about a certain item. Any element with its itemscope property defined generates a new item, which leads to several name-value pairs being connected to the element.

Itemscope Id Attributes

A new item is created for each element for which the itemscope property is specified. The item consists of a collection of name-value pairs. An id attribute can also be specified for elements that include itemscope and itemtype attributes. The new item can have a global identification set using the id attribute. An item's ability to relate to other items on pages throughout the Web is made possible by its global identifier.

Syntax

<element itemscope></element>

Examples

Example 1

The itemscope attribute in HTML is demonstrated in the example below.

<!DOCTYPE html>

<html>

<body>

            <center>

                        <h1 style="color:red;">

                                    Javatpoint

                        </h1>

                        <strong>HTML itemscope Attribute</strong>

            </center>

            <div itemscope itemtype= "https://www.youtube.com/channel/UC0RhatS1pyxInC00YKjjBqQ">

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

                        <span>Javatpoint:

                                    <span itemprop="topic">A Computer</span>

                                    Science portal 

                        </span>

                        <span itemprop="stack">Web Developer</span>

                        <a href=  "https://www.youtube.com/watch?v=Bjed-kudYkU"

                                                itemprop="full_course">Visit Courses</a>

            </div>

</body>

</html>

Structured data: The data from the previous example is displayed in the following table.

itemscopeitem typechannel
itemprop(itemprop name)(itemprop value)
itemproptopicA Computer
itempropstackWeb Developer
itempropnameCourses
itempropfull_courseVisit Courses

Example 2:

<!DOCTYPE html>

<html>

<body>

            <center>

                        <h1 style="color:red;">

                                    Javatpoint

                        </h1>

                                    <strong>HTML itemscope Attribute</strong>

            </center>

            <div itemscope itemtype=

"https://www.youtube.com/channel/UC0RhatS1pyxInC00YKjjBqQ">

                        <h1 itemprop="name">DSA Courses</h1>

                        <span>Javatpoint:

                                    <span itemprop="topic">A Computer</span>

                                    Science portal

                        </span>

                        <br>

                        <ul>

                                    <li>

                                                <span itemprop="stack">

                                                            Competitive Programming

                                                </span>

                                                <a href=

"https://www.javatpoint.org/courses/competitive-programming-live?utm_source=gfg-article&utm_medium=Q1-2023&utm_campaign=competitive-programming-live"

                                                            itemprop="full_course">Visit Courses</a>

                                    </li>

                                    <li><span itemprop="stack">

                                                DataStructure & Algorithm

                                    </span>

                                                <a href=

"https://www.javatpoint.org/courses/dsa-self-paced?utm_source=gfg-article&utm_medium=Q1-2023&utm_campaign=dsa-self-paced"

                                                            itemprop="course">Visit Courses</a>

                                    </li>

                        </ul>

            </div>

</body>

</html>

Structured data: The data from the previous example is displayed in the following table.

          itemscopeitem typechannel
itemprop(itemprop name)(itemprop value)
itemproptopicA Computer
itempropstackCompetitive Programming
itempropnameCourses
itempropfull_courseVisit Courses
itempropstackDataStructure & Algorithm
 itempropcourseVisit Courses

Example 3:

Representing structured data for a recipe

The following example has four itemscope properties. The matching item attribute determines the scope of each item element. As indicated by the first item type,  item types Recipe, AggregateRating, and NutritionInformation in the example below are schema.org structured data for a recipe.

<div itemscope itemtype="https://schema.org/Recipe">

  <h2 itemprop="name">Grandma's Holiday Apple Pie</h2>

  <img

    itemprop="image"

    src="https://c1.staticflickr.com/1/30/42759561_8631e2f905_n.jpg"

    width="50"

    height="50" />

  <p>

    By

    <span itemprop="author" itemscope itemtype="https://schema.org/Person">

      <span itemprop="name">Carol Smith</span>

    </span>

  </p>

  <p>

    Published:

    <time datetime="2022-11-05" itemprop="datePublished">

      November 5, 20022

    </time>

  </p>

  <span itemprop="description">

    This is my grandmother's apple pie recipe. I like to add a dash of nutmeg.

  </span>

  <br />

  <span

    itemprop="aggregate rating"

    item scope

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

    <span itemprop="rating value">4.0</span> stars based on

    <span itemprop="reviewCount">35</span> reviews

  </span>

  <br />

  Prep time: <time datetime="PT30M" itemprop="prep-time">30 min</time>

  <br />

  Cook time: <time datetime="PT1H" itemprop="cookTime">1 hour</time>

  <br />

  Total time: <time datetime="PT1H30M" itemprop="total-time">1 hour 30 min</time>

  <br />

  Yield: <span itemprop="recipeYield">1 9" pie (8 servings)</span>

  <br />

  <span

    itemprop="nutrition"

    itemscope

    itemtype="https://schema.org/NutritionInformation">

    Serving size: <span itemprop="servingSize">1 medium slice</span><br />

    Calories per serving: <span itemprop="calories">250 cal</span><br />

    Fat per serving: <span itemprop="fatContent">12 g</span><br />

  </span>

  <p>

    Ingredients:<br />

    <span itemprop="recipeIngredient">Thinly-sliced apples: 6 cups<br /></span>

    <span itemprop="recipeIngredient">White sugar: 3/4 cup<br /></span>

    …

  </p>

  Directions: <br />

  <div itemprop="recipeInstructions">

    1. Cut and peel apples<br />

    2. Mix sugar and cinnamon. Use additional sugar for tart apples. <br />

    …

  </div>

</div>

Representing structured data for a movie

The itemtype is defined as "http://schema.org/Movie" in the example below, and four associated itemprop properties are specified.

 Item typeMovie
 itemprop(itemprop name)(itemprop value)
itemscopeitempropdirectorPrashanth Varma
 itempropgenreAction, Comedy, Superhero, Adventure
 itempropnameHanuman
 itemproptrailerhttps://www.youtube.com/watch?v=MKqJBhOgapM

HTML

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

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

  <span>

    Director: <span itemprop="director">Prashanth Varma </span>

  </span>

  <span itemprop="genre"> Action, Comedy, Superhero, Adventure </span>

  <a href=" https://www.youtube.com/watch?v=MKqJBhOgapM " itemprop="trailer">Trailer</a>

</div>

Supported Browsers

Opera

Google Chrome

Edge 12 and above

Mozilla Firefox

Safari