Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

HTML itemid Attribute

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

In this article, we will know about HTML itemid attribute with its implementation through the examples. 

We know that all the HTML elements have attributes as they provide additional information about that particular element. It takes two parameters, name and value which define the properties of the element and are placed inside the element tag.

The itemid is a type of global attribute. Attributes that are common to all elements of HTML that provide microdata in the form of a unique, global identifier of an item. You should use this attribute only when you are using microdata. This attribute can only be used with those elements that have both itemscope and itemtype attributes. If the itemid attribute is missing then it is said to have no global identifier.

Syntax:

<dl itemscope
   itemtype="https://www.geeksforgeeks.org/html-book"
   itemid="urn:isbn:0-323-34323-9">

Attribute Value: This attribute must have a value that is a valid URL having no leading and trailing whitespace.

Supported tags:

  • <dl>

Note: The itemid must be URL or you can also use URN as we have used in the below example.

Example 1:

HTML




<!DOCTYPE html>
<html>
<head>
  <title>GeeksforGeeks</title>
</head>
<body>   
    <h2>Welcome To GFG Books</h2>
    <dl itemscope="" itemtype=
        itemid="urn:isbn:0-330-34032-8">
    <dt>Title </dt>
    <dd itemprop="title">
       The Intro to C++
    </dd>
    <dt>Author </dt>   
    <dd itemprop="author">
       GFG Pvt. Ltd.
    </dd>
    <dt>Publication date </dt>
    <dd>
      <time itemprop="pubdate" datetime="1996-01-26">
       26 January 1996
       </time>
     </dd>
    </dl>
</body>
</body>
</html>

Output:

HTML itemid Attribute

Example 2:

HTML




<!DOCTYPE html>
<html>
<head>
<title>GeeksforGeeks</title>
</head>
    <body>
    <h2>Geeks Courses</h2>
    <dl itemscope=""
        itemtype="https://www.geeksforgeeks.org/course"
        itemid="urn:crn-01-2021">
        <dt>Name </dt>
        <dd itemprop="title">Intro to Java</dd>
        <dt>Instructor </dt>
        <dd itemprop="author">Geeky G</dd>
        <dt>Start date</dt>
        <dd><time itemprop="pubdate"
                datetime="1996-01-26">
                10 Jan 2022
            </time>
        </dd>
    </dl>
</body>
</html>

Output:

HTML itemid Attribute

Supported Browser:

  • Google Chrome
  • Edge 12 and above
  • Firefox
  • Opera
  • Safari

My Personal Notes arrow_drop_up
Last Updated : 24 Aug, 2022
Like Article
Save Article
Similar Reads
Related Tutorials