blob: 08d1929b6c5dd6873bed19e74750ced556aae597 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
---
title: itemid
slug: Web/HTML/Global_attributes/itemid
tags:
- Attribute
- Global attribute
- HTML
- Microdata
- Reference
translation_of: Web/HTML/Global_attributes/itemid
---
<div>{{HTMLSidebar("Global_attributes")}}</div>
<p><code><strong>itemid</strong></code> <a href="/en-US/docs/Web/HTML/Global_attributes">全局属性</a> 是元素的唯一的全局标识符。<code>itemid</code> 属性只能为同时拥有 <strong><code>itemscope</code> </strong>和 <strong><code>itemtype</code></strong> 的元素指定。同时,<code>itemid</code> 只能为拥有 <code>itemscope</code> 的元素指定,它的相应 <code>itemtype</code> 引用或定义了支持全局标识符的词汇。</p>
<p><code>itemtype</code> 的全局标识符的准确含义,由该标识符以指定的词汇提供。词汇定义了全局标识符相同的多个元素是否可以共存,并且如果是这样,这些元素如何处理。 </p>
<p class="note"><strong>注:</strong>Whatwg.org 的定义规定了 <code>itemid</code> 必须是 URL。但是,下面的示例正确展示了 URN 也可以使用。这个不一致性可能反映了 Microdata 规范的不完善性。</p>
<h2 id="示例">示例</h2>
<h3 id="HTML">HTML</h3>
<pre class="brush: html"><dl itemscope
itemtype="http://vocab.example.net/book"
itemid="urn:isbn:0-330-34032-8">
<dt>Title <dd itemprop="title">The Reality Dysfunction
<dt>Author <dd itemprop="author">Peter F. Hamilton
<dt>Publication date
<dd><time itemprop="pubdate" datetime="1996-01-26">26 January 1996</time> </dl></pre>
<h3 id="结构化数据">结构化数据</h3>
<table class="standard-table">
<tbody>
<tr>
<td colspan="1" rowspan="14">itemscope</td>
<td>itemtype: itemid</td>
<td colspan="2" rowspan="1">
<div class="jyrRxf-eEDwDf jcd3Mb IZ65Hb-hUbt4d">http://vocab.example.net/book: urn:isbn:0-330-34032-8</div>
</td>
</tr>
<tr>
<td>itemprop</td>
<td>title</td>
<td>The Reality Dysfunction</td>
</tr>
<tr>
<td>itemprop</td>
<td>author</td>
<td>
<div class="jyrRxf-eEDwDf jcd3Mb">Peter F. Hamilton</div>
</td>
</tr>
<tr>
<td>itemprop</td>
<td>pubdate</td>
<td>1996-01-26</td>
</tr>
</tbody>
</table>
<h3 id="结果">结果</h3>
<p>{{EmbedLiveSample('示例')}}</p>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td><code><a href="https://html.spec.whatwg.org/multipage/microdata.html#attr-itemid">itemid</a></code></td>
<td> </td>
<td>WG Note - No longer being actively developed</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
{{Compat("html.global_attributes.itemid")}}
<h2 id="另见">另见</h2>
<ul>
<li><a href="/en-US/docs/Web/HTML/Global_attributes">其它不同的全局属性</a></li>
<li>其它 microdata 相关的全局属性
<ul>
<li>{{htmlattrxref("itemid")}}</li>
<li>{{htmlattrxref("itemprop")}}</li>
<li>{{htmlattrxref("itemref")}}</li>
<li>{{htmlattrxref("itemscope")}}</li>
<li>{{htmlattrxref("itemtype")}}</li>
</ul>
</li>
</ul>
|