HTML itemref global attribute
Properties that are not descendants of an element with theitemscope
attribute can be associated with an item using theglobal attributeitemref
.
itemref
provides a list of element IDs (notitemid
s) elsewhere in the document, with additional properties
Theitemref
attribute can only be specified on elements that have anitemscope
attribute specified.
Note:Theitemref
attribute is not part of the microdata data model. It is merely a syntactic construct to aid authors in adding annotations to pages where the data to be annotated does not follow a convenient tree structure. For example, it allows authors to mark up data in a table so that each column defines a separate item while keeping the properties in the cells.
Examples
Representing structured data for a band
This example uses microdata attributes to represent the following structured data (inJSON-LD format):
{ "@id": "amanda", "name": "Amanda", "band": { "@id": "b", "name": "Jazz Band", "size": 12 }}
HTML
<div itemscope itemref="a b"></div><p>Name: <span itemprop="name">Amanda</span></p><div itemprop="band" itemscope itemref="c"></div><div> <p>Band: <span itemprop="name">Jazz Band</span></p> <p>Size: <span itemprop="size">12</span> players</p></div>
Result
Specifications
Specification |
---|
HTML # attr-itemref |
See also
- Other different global attributes
- Other microdata related global attributes: