1. 面向开发者的 Web 技术
  2. HTML(超文本标记语言)
  3. HTML 参考
  4. 全局属性
  5. itemid

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

itemid

itemid 全局属性 是元素的唯一的全局标识符。itemid 属性只能为同时拥有 itemscopeitemtype 的元素指定。同时,itemid 只能为拥有 itemscope 的元素指定,它的相应 itemtype 引用或定义了支持全局标识符的词汇。

itemtype 的全局标识符的准确含义,由该标识符以指定的词汇提供。词汇定义了全局标识符相同的多个元素是否可以共存,并且如果是这样,这些元素如何处理。

**注:**Whatwg.org 的定义规定了 itemid 必须是 URL。但是,下面的示例正确展示了 URN 也可以使用。这个不一致性可能反映了 Microdata 规范的不完善性。

示例

HTML

html
<dl
 itemscope
 itemtype="http://vocab.example.net/book"
 itemid="urn:isbn:0-330-34032-8">
 <dt>Title</dt>
 <dd itemprop="title">The Reality Dysfunction</dd>
 <dt>Author</dt>
 <dd itemprop="author">Peter F. Hamilton</dd>
 <dt>Publication date</dt>
 <dd><time itemprop="pubdate" datetime="1996-01-26">26 January 1996</time></dd>
</dl>

结构化数据

itemscope itemtype: itemid
http://vocab.example.net/book: urn:isbn:0-330-34032-8
itemprop title The Reality Dysfunction
itemprop author Peter F. Hamilton
itemprop pubdate 1996年01月26日

结果

规范

Specification
HTML
# attr-itemid

浏览器兼容性

参见

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /