diff options
Diffstat (limited to 'files/zh-cn/web/html/global_attributes/itemid')
-rw-r--r-- | files/zh-cn/web/html/global_attributes/itemid/index.html | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/files/zh-cn/web/html/global_attributes/itemid/index.html b/files/zh-cn/web/html/global_attributes/itemid/index.html new file mode 100644 index 0000000000..6d42d5bca7 --- /dev/null +++ b/files/zh-cn/web/html/global_attributes/itemid/index.html @@ -0,0 +1,149 @@ +--- +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> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<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> |