Global Attribute
HTML5
The itemtype attribute specifies the URL of the vocabulary that defines the item properties in Microdata. It works in conjunction with the itemscope attribute to create structured data that search engines and other tools can understand, enabling rich snippets in search results and improved SEO.
Interactive code playground requires JavaScript. Here's the code:
<div itemscope itemtype="https://schema.org/Person">
<h2 itemprop="name">Jane Smith</h2>
<p itemprop="jobTitle">Software Engineer</p>
<p>Email: <a href="mailto:jane@example.com" itemprop="email">jane@example.com</a></p>
<p itemprop="telephone">(555) 123-4567</p>
</div>
<style>
div[itemscope] {
background: #f8fafc;
border-left: 4px solid #3b82f6;
padding: 20px;
border-radius: 6px;
}
h2 {
margin: 0 0 10px 0;
color: #1e293b;
}
p {
margin: 5px 0;
color: #475569;
}
</style>
< element itemscope itemtype = " vocabulary-url " >
< span itemprop = " property " > value </ span >
The itemtype attribute must:
Value Description URLAn absolute URL pointing to the vocabulary definition. Most commonly uses Schema.org URLs (e.g., https://schema.org/Person).
Schema.org is the most widely used vocabulary for structured data on the web. Here are the most common types:
Interactive code playground requires JavaScript. Here's the code:
<div itemscope itemtype="https://schema.org/Person">
<img itemprop="image" src="https://via.placeholder.com/100" alt="Profile" style="border-radius: 50%; float: left; margin-right: 15px;">
<h3 itemprop="name">Dr. Emily Chen</h3>
<p><strong itemprop="jobTitle">Chief Technology Officer</strong></p>
<p itemprop="worksFor" itemscope itemtype="https://schema.org/Organization">
<span itemprop="name">TechCorp Industries</span>
</p>
<p>
<a itemprop="url" href="https://example.com">Website</a> |
<a itemprop="email" href="mailto:emily@example.com">Contact</a>
</p>
</div>
<style>
div[itemscope] {
background: white;
border: 1px solid #e2e8f0;
padding: 20px;
border-radius: 8px;
overflow: auto;
}
h3 {
margin: 0 0 5px 0;
color: #0f172a;
}
p {
margin: 5px 0;
color: #64748b;
}
</style>
Interactive code playground requires JavaScript. Here's the code:
<div itemscope itemtype="https://schema.org/Product">
<h3 itemprop="name">Ultra HD Webcam Pro</h3>
<img itemprop="image" src="https://via.placeholder.com/200x150" alt="Product" style="width: 200px; border-radius: 6px;">
<div itemprop="offers" itemscope itemtype="https://schema.org/Offer">
<p>Price: <span itemprop="price" content="129.99">$129.99</span></p>
<meta itemprop="priceCurrency" content="USD">
<link itemprop="availability" href="https://schema.org/InStock">
<p style="color: #16a34a; font-weight: bold;">✓ In Stock</p>
</div>
<div itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
<p>Rating: <span itemprop="ratingValue">4.5</span>/5
(<span itemprop="reviewCount">248</span> reviews)</p>
</div>
</div>
<style>
div[itemscope] {
background: #fefce8;
border: 2px solid #fde047;
padding: 20px;
border-radius: 8px;
}
h3 {
margin: 0 0 10px 0;
}
img {
margin: 10px 0;
}
</style>
Interactive code playground requires JavaScript. Here's the code:
<div itemscope itemtype="https://schema.org/Organization">
<h3 itemprop="name">Acme Corporation</h3>
<p itemprop="description">Leading provider of innovative solutions since 1990</p>
<div itemprop="address" itemscope itemtype="https://schema.org/PostalAddress">
<p><strong>Address:</strong></p>
<p itemprop="streetAddress">123 Business Ave</p>
<p>
<span itemprop="addressLocality">San Francisco</span>,
<span itemprop="addressRegion">CA</span>
<span itemprop="postalCode">94102</span>
</p>
</div>
<p>Phone: <span itemprop="telephone">+1-555-0123</span></p>
<p>Website: <a itemprop="url" href="https://acme.example.com">acme.example.com</a></p>
</div>
<style>
div[itemtype*="Organization"] {
background: #eff6ff;
border-left: 4px solid #3b82f6;
padding: 20px;
border-radius: 6px;
}
h3 {
margin: 0 0 10px 0;
color: #1e40af;
}
</style>
Interactive code playground requires JavaScript. Here's the code:
<div itemscope itemtype="https://schema.org/Event">
<h3 itemprop="name">Web Development Conference 2025</h3>
<p itemprop="description">Join us for the biggest web dev event of the year!</p>
<p><strong>Date:</strong>
<time itemprop="startDate" datetime="2025-06-15T09:00">June 15, 2025 at 9:00 AM</time>
</p>
<div itemprop="location" itemscope itemtype="https://schema.org/Place">
<p><strong>Location:</strong> <span itemprop="name">Tech Convention Center</span></p>
<div itemprop="address" itemscope itemtype="https://schema.org/PostalAddress">
<span itemprop="addressLocality">Seattle</span>,
<span itemprop="addressRegion">WA</span>
</div>
</div>
<div itemprop="offers" itemscope itemtype="https://schema.org/Offer">
<p>Tickets: <span itemprop="price">$299</span> <span itemprop="priceCurrency" content="USD">USD</span></p>
<link itemprop="availability" href="https://schema.org/InStock">
</div>
</div>
<style>
div[itemtype*="Event"] {
background: #f0fdf4;
border: 2px solid #22c55e;
padding: 20px;
border-radius: 8px;
}
h3 {
margin: 0 0 10px 0;
color: #15803d;
}
</style>
Interactive code playground requires JavaScript. Here's the code:
<article itemscope itemtype="https://schema.org/Article">
<header>
<h3 itemprop="headline">Understanding Microdata in HTML5</h3>
<p>By <span itemprop="author" itemscope itemtype="https://schema.org/Person">
<span itemprop="name">John Doe</span>
</span></p>
<time itemprop="datePublished" datetime="2025-01-15">January 15, 2025</time>
</header>
<div itemprop="articleBody">
<p>Microdata is a powerful way to add structured data to your HTML documents...</p>
</div>
<footer>
<p>Published in: <span itemprop="publisher" itemscope itemtype="https://schema.org/Organization">
<span itemprop="name">HTML.sh Blog</span>
</span></p>
</footer>
</article>
<style>
article {
background: white;
border: 1px solid #e5e7eb;
padding: 20px;
border-radius: 8px;
}
header h3 {
margin: 0 0 10px 0;
}
time {
color: #6b7280;
font-size: 0.9em;
}
</style>
Interactive code playground requires JavaScript. Here's the code:
<div itemscope itemtype="https://schema.org/LocalBusiness">
<h3 itemprop="name">Joe's Coffee Shop</h3>
<img itemprop="image" src="https://via.placeholder.com/250x150" alt="Coffee Shop" style="width: 100%; border-radius: 6px;">
<div itemprop="address" itemscope itemtype="https://schema.org/PostalAddress">
<p><span itemprop="streetAddress">456 Main Street</span><br>
<span itemprop="addressLocality">Portland</span>,
<span itemprop="addressRegion">OR</span>
<span itemprop="postalCode">97201</span></p>
</div>
<p>Phone: <span itemprop="telephone">(503) 555-1234</span></p>
<div itemprop="openingHoursSpecification" itemscope itemtype="https://schema.org/OpeningHoursSpecification">
<p><strong>Hours:</strong>
<link itemprop="dayOfWeek" href="https://schema.org/Monday">
<link itemprop="dayOfWeek" href="https://schema.org/Friday">
Mon-Fri: <time itemprop="opens" content="07:00">7:00 AM</time> -
<time itemprop="closes" content="19:00">7:00 PM</time></p>
</div>
</div>
<style>
div[itemtype*="LocalBusiness"] {
background: #fef3c7;
border: 2px solid #f59e0b;
padding: 20px;
border-radius: 8px;
max-width: 300px;
}
h3 {
margin: 0 0 10px 0;
}
img {
margin: 10px 0;
}
</style>
Interactive code playground requires JavaScript. Here's the code:
<div itemscope itemtype="https://schema.org/Recipe">
<h3 itemprop="name">Classic Chocolate Chip Cookies</h3>
<img itemprop="image" src="https://via.placeholder.com/300x200" alt="Cookies" style="width: 100%; border-radius: 6px;">
<p itemprop="description">Delicious homemade chocolate chip cookies that are crispy on the outside and chewy on the inside.</p>
<div>
<p><strong>Prep Time:</strong> <time itemprop="prepTime" datetime="PT15M">15 minutes</time></p>
<p><strong>Cook Time:</strong> <time itemprop="cookTime" datetime="PT12M">12 minutes</time></p>
<p><strong>Yield:</strong> <span itemprop="recipeYield">24 cookies</span></p>
</div>
<div itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
<p>Rating: <span itemprop="ratingValue">4.8</span>/5
(<span itemprop="reviewCount">156</span> reviews)</p>
</div>
</div>
<style>
div[itemtype*="Recipe"] {
background: #fef2f2;
border: 2px solid #ef4444;
padding: 20px;
border-radius: 8px;
max-width: 350px;
}
h3 {
margin: 0 0 10px 0;
color: #991b1b;
}
img {
margin: 10px 0;
}
</style>
Interactive code playground requires JavaScript. Here's the code:
<div itemscope itemtype="https://schema.org/FAQPage">
<h3>Frequently Asked Questions</h3>
<div itemscope itemprop="mainEntity" itemtype="https://schema.org/Question">
<h4 itemprop="name">What is Microdata?</h4>
<div itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer">
<div itemprop="text">
<p>Microdata is an HTML specification used to nest metadata within existing content on web pages.</p>
</div>
</div>
</div>
<div itemscope itemprop="mainEntity" itemtype="https://schema.org/Question">
<h4 itemprop="name">Why use structured data?</h4>
<div itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer">
<div itemprop="text">
<p>Structured data helps search engines understand your content better and can result in rich snippets in search results.</p>
</div>
</div>
</div>
</div>
<style>
div[itemtype*="FAQPage"] {
background: #f5f3ff;
border-left: 4px solid #8b5cf6;
padding: 20px;
border-radius: 6px;
}
h3 {
margin: 0 0 15px 0;
color: #5b21b6;
}
h4 {
margin: 15px 0 5px 0;
color: #6d28d9;
}
p {
margin: 5px 0;
}
</style>
Interactive code playground requires JavaScript. Here's the code:
<div itemscope itemtype="https://schema.org/HowTo">
<h3 itemprop="name">How to Change a Tire</h3>
<p itemprop="description">Learn how to safely change a flat tire in 5 easy steps.</p>
<p><strong>Total Time:</strong> <time itemprop="totalTime" datetime="PT20M">20 minutes</time></p>
<div itemprop="step" itemscope itemtype="https://schema.org/HowToStep">
<p><strong>Step <span itemprop="position">1</span>:</strong></p>
<p itemprop="text">Park on a flat surface and engage the parking brake.</p>
</div>
<div itemprop="step" itemscope itemtype="https://schema.org/HowToStep">
<p><strong>Step <span itemprop="position">2</span>:</strong></p>
<p itemprop="text">Loosen the lug nuts with a wrench before jacking up the car.</p>
</div>
<div itemprop="step" itemscope itemtype="https://schema.org/HowToStep">
<p><strong>Step <span itemprop="position">3</span>:</strong></p>
<p itemprop="text">Use the jack to lift the vehicle off the ground.</p>
</div>
</div>
<style>
div[itemtype*="HowTo"] {
background: #ecfeff;
border: 2px solid #06b6d4;
padding: 20px;
border-radius: 8px;
}
h3 {
margin: 0 0 10px 0;
color: #0e7490;
}
div[itemprop="step"] {
margin: 10px 0;
padding: 10px;
background: white;
border-radius: 4px;
}
</style>
You can specify multiple types for an item by providing space-separated URLs. This is useful when an item fits multiple vocabularies:
Interactive code playground requires JavaScript. Here's the code:
<div itemscope itemtype="https://schema.org/Restaurant https://schema.org/LocalBusiness">
<h3 itemprop="name">The Golden Fork</h3>
<p itemprop="servesCuisine">Italian</p>
<div itemprop="address" itemscope itemtype="https://schema.org/PostalAddress">
<p><span itemprop="streetAddress">789 Food Street</span><br>
<span itemprop="addressLocality">Chicago</span>,
<span itemprop="addressRegion">IL</span></p>
</div>
<p>Phone: <span itemprop="telephone">(312) 555-9876</span></p>
<div itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
<p>Rating: <span itemprop="ratingValue">4.7</span>/5 stars</p>
</div>
<p style="color: #059669; font-weight: bold;">✓ Takes Reservations</p>
</div>
<style>
div[itemscope] {
background: #fef7cd;
border: 2px solid #eab308;
padding: 20px;
border-radius: 8px;
max-width: 320px;
}
h3 {
margin: 0 0 10px 0;
}
</style>
While Schema.org is the most common vocabulary, you can use custom vocabularies by providing your own URL:
< div itemscope itemtype = " https://example.com/vocab/CustomProduct " >
< span itemprop = " productCode " > ABC123 </ span >
< span itemprop = " internalCategory " > electronics </ span >
The itemtype attribute, when used with proper Microdata markup, can significantly enhance your site’s appearance in search results:
Rich snippets are enhanced search results that display additional information beyond the standard title, URL, and description. They can include:
Products can show price, availability, and ratings directly in search results, increasing click-through rates.
< div itemscope itemtype = " https://schema.org/Product " >
< span itemprop = " name " > Wireless Headphones </ span >
< div itemprop = " offers " itemscope itemtype = " https://schema.org/Offer " >
< span itemprop = " price " > 79.99 </ span >
< meta itemprop = " priceCurrency " content = " USD " >
< div itemprop = " aggregateRating " itemscope
itemtype = " https://schema.org/AggregateRating " >
< span itemprop = " ratingValue " > 4.5 </ span > stars
Recipes can display cooking time, ratings, and calorie information in search results.
< div itemscope itemtype = " https://schema.org/Recipe " >
< span itemprop = " name " > Banana Bread </ span >
< time itemprop = " totalTime " datetime = " PT1H " > 1 hour </ time >
< div itemprop = " nutrition " itemscope
itemtype = " https://schema.org/NutritionInformation " >
< span itemprop = " calories " > 240 calories </ span >
Events can show dates, locations, and ticket availability in search results.
< div itemscope itemtype = " https://schema.org/Event " >
< span itemprop = " name " > Summer Music Festival </ span >
< time itemprop = " startDate " datetime = " 2025-07-15 " > July 15, 2025 </ time >
< div itemprop = " location " itemscope itemtype = " https://schema.org/Place " >
< span itemprop = " name " > Central Park </ span >
FAQs can be displayed as expandable questions directly in search results.
< div itemscope itemtype = " https://schema.org/FAQPage " >
< div itemprop = " mainEntity " itemscope
itemtype = " https://schema.org/Question " >
< h3 itemprop = " name " > What is HTML? </ h3 >
< div itemprop = " acceptedAnswer " itemscope
itemtype = " https://schema.org/Answer " >
HTML is the standard markup language for creating web pages.
Use these tools to validate your Microdata markup:
The itemtype attribute is supported in all modern browsers as part of the HTML5 Microdata specification.
Browser Version Notes Chrome 6+ Full support Firefox 16+ Full support Safari 5+ Full support Edge All versions Full support Opera 11.6+ Full support
Choose the most specific Schema.org type that applies to your content:
< div itemscope itemtype = " https://schema.org/Thing " >
< span itemprop = " name " > My Restaurant </ span >
<!-- Better - more specific -->
< div itemscope itemtype = " https://schema.org/Restaurant " >
< span itemprop = " name " > My Restaurant </ span >
< span itemprop = " servesCuisine " > Italian </ span >
Each Schema.org type has required properties. Always include them for valid markup:
<!-- Product requires name and at least one of offers, review, or aggregateRating -->
< div itemscope itemtype = " https://schema.org/Product " >
< span itemprop = " name " > Laptop Computer </ span >
< div itemprop = " offers " itemscope itemtype = " https://schema.org/Offer " >
< span itemprop = " price " > 899.99 </ span >
< meta itemprop = " priceCurrency " content = " USD " >
Nest related types to provide comprehensive structured data:
< div itemscope itemtype = " https://schema.org/JobPosting " >
< span itemprop = " title " > Frontend Developer </ span >
< div itemprop = " hiringOrganization " itemscope
itemtype = " https://schema.org/Organization " >
< span itemprop = " name " > TechCorp </ span >
< div itemprop = " jobLocation " itemscope
itemtype = " https://schema.org/Place " >
< div itemprop = " address " itemscope
itemtype = " https://schema.org/PostalAddress " >
< span itemprop = " addressLocality " > New York </ span >
Whenever possible, use Microdata on visible content rather than hidden elements:
<!-- Preferred - marking up visible content -->
< h1 itemprop = " name " > Product Name </ h1 >
< p itemprop = " description " > This is the product description. </ p >
<!-- Avoid - hidden metadata (unless necessary) -->
< meta itemprop = " name " content = " Product Name " >
< meta itemprop = " description " content = " This is the product description. " >
The itemtype attribute requires itemscope to be present:
<!-- Wrong - itemtype without itemscope -->
< div itemtype = " https://schema.org/Person " >
< span itemprop = " name " > John Doe </ span >
< div itemscope itemtype = " https://schema.org/Person " >
< span itemprop = " name " > John Doe </ span >
The itemtype value must be an absolute URL:
<!-- Wrong - relative URL -->
< div itemscope itemtype = " /schema/Person " >
<!-- Correct - absolute URL -->
< div itemscope itemtype = " https://schema.org/Person " >
Use the exact property names defined in the vocabulary:
<!-- Wrong - "fullName" is not a valid Person property -->
< div itemscope itemtype = " https://schema.org/Person " >
< span itemprop = " fullName " > John Doe </ span >
<!-- Correct - "name" is the valid property -->
< div itemscope itemtype = " https://schema.org/Person " >
< span itemprop = " name " > John Doe </ span >