--- title: itemscope slug: Web/HTML/Global_attributes/itemscope tags: - Attribut - Attribut universel - HTML - Micro-données - Microdata - Reference translation_of: Web/HTML/Global_attributes/itemscope original_slug: Web/HTML/Attributs_universels/itemscope --- {{HTMLSidebar("Global_attributes")}} L'[attribut universel](/fr/docs/Web/HTML/Attributs_universels) **`itemscope`** fonctionne généralement avec l'attribut `itemtype` afin d'indiquer qu'un bloc HTML contient un objet donné. `itemscope` crée l'objet et définit la portée de l'`itemtype` associé. Il est possible d'associer un attribut `itemscope` à n'importe quel élément HTML. ### Les identifiants rattachés à `itemscope` Un élément qui possède un attribut `itemscope` permet de définir un nouvel élément qui sera un groupe de paires de noms/valeurs. Les éléments qui ont un attribut `itemscope` et un attribut `itemtype` peuvent également définir un attribut `id` (à ne pas confondre avec `itemid)` pour identifier de façon unique l'élément sur le Web. ## Syntaxe ### Syntaxe formelle itemscope ## Exemple Dans cet exemple, on a trois attributs `itemscopes`. Ces trois `itemscopes` définissent les portées respectives des `itemtypes` correspondants qui sont : Recipe, AggregateRating et NutritionInformation. ### HTML ```html

Grandma's Holiday Apple Pie

By

Published:

This is my grandmother's apple pie recipe. I like to add a dash of nutmeg.
4.0 stars based on 35 reviews
Prep time: Cook time: Total time: Yield: 1 9" pie (8 servings)
Serving size: 1 medium slice
Calories per serving: 250 cal
Fat per serving: 12 g

Ingredients:
Thinly-sliced apples: 6 cups
White sugar: 3/4 cup
...

Directions:
1. Cut and peel apples
2. Mix sugar and cinnamon. Use additional sugar for tart apples.
...
``` ### Structure des données
itemscope itemtype Recipe
itemprop name: Grandma's Holiday Apple Pie
itemprop image: https://c1.staticflickr.com/1/30/42759561_8631e2f905_n.jpg
itemprop datePublished: 2009-11-05
itemprop description: This is my grandmother's apple pie recipe. I like to add a dash of nutmeg.
itemprop prepTime: PT30M
itemprop cookTime: PT1H
itemprop totalTime: PT1H30M
itemprop recipeYield: 1 9" pie (8 servings)
itemprop recipeIngredient: Thinly-sliced apples: 6 cups
itemprop recipeIngredient: White sugar: 3/4 cup
itemprop recipeInstructions: 1. Cut and peel apples 2. Mix sugar and cinnamon. Use additional sugar for tart apples .
itemprop author [Person]:
itemprop name: Carol Smith
itemscope itemprop[itemtype] aggregateRating [AggregateRating]:
itemprop ratingValue: 4.0
itemprop reviewCount: 35
itemscope itemprop[itemtype] nutrition [NutritionInformation]:
itemprop servingSize: 1 medium slice
itemprop calories: 250 cal
itemprop fatContent: 12 g
> **Note :** Pour extraire des micro-données d'un document HTML, vous pouvez utiliser [l'outil d'extraction de Google pour les micro-données.](https://developers.google.com/structured-data/testing-tool/) Vous pouvez par exemple utiliser le document HTML précédent. ## Spécifications | Spécification | État | Commentaires | | ------------------------------------------------------------------------------------------------ | ------------------------------------ | ------------ | | {{SpecName('HTML Microdata', "#dfn-itemscope", "itemscope")}} | {{Spec2('HTML Microdata')}} | | | {{SpecName('HTML WHATWG', "microdata.html#attr-itemscope", "itemscope")}} | {{Spec2('HTML WHATWG')}} | | ## Compatibilité des navigateurs {{Compat("html.global_attributes.itemscope")}} ## Voir aussi - [Les différents attributs universels](/fr/docs/Web/HTML/Attributs_universels) - Les autres attributs universels relatifs aux microdonnées : - {{htmlattrxref("itemid")}} - {{htmlattrxref("itemprop")}} - {{htmlattrxref("itemref")}} - {{htmlattrxref("itemscope")}} - {{htmlattrxref("itemtype")}}