--- 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
By Carol Smith
Published:
This is my grandmother's apple pie recipe. I like to add a dash of nutmeg.Ingredients:
Thinly-sliced apples: 6 cups
White sugar: 3/4 cup
...
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 |