diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
| commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
| tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/html/element/data | |
| parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
| download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip | |
initial commit
Diffstat (limited to 'files/zh-cn/web/html/element/data')
| -rw-r--r-- | files/zh-cn/web/html/element/data/index.html | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/files/zh-cn/web/html/element/data/index.html b/files/zh-cn/web/html/element/data/index.html new file mode 100644 index 0000000000..860165d4c4 --- /dev/null +++ b/files/zh-cn/web/html/element/data/index.html @@ -0,0 +1,99 @@ +--- +title: <data> +slug: Web/HTML/Element/data +tags: + - HTML + - Web + - 元素 + - 参考 +translation_of: Web/HTML/Element/data +--- +<div>{{HTMLRef}}</div> + +<p><strong>HTML <code><data></code> 元素</strong>将一个指定内容和机器可读的翻译联系在一起。但是,如果内容是与时间或者日期相关的,则一定要使用 {{HTMLElement("time")}}。</p> + +<div>{{EmbedInteractiveExample("pages/tabbed/data.html", "tabbed-shorter")}}</div> + + + +<table class="properties"> + <tbody> + <tr> + <th scope="row"><a href="/en-US/docs/Web/HTML/Content_categories">Content categories</a></th> + <td><a href="/en-US/docs/Web/HTML/Content_categories#Flow_content">Flow content</a>, <a href="/en-US/docs/Web/HTML/Content_categories#Phrasing_content">phrasing content</a>, palpable content.</td> + </tr> + <tr> + <th scope="row">Permitted content</th> + <td><a href="/en-US/docs/Web/HTML/Content_categories#Phrasing_content">Phrasing content</a>.</td> + </tr> + <tr> + <th scope="row">Tag omission</th> + <td>{{no_tag_omission}}</td> + </tr> + <tr> + <th scope="row">Permitted parents</th> + <td>Any element that accepts <a href="/en-US/docs/Web/HTML/Content_categories#Phrasing_content">phrasing content</a>.</td> + </tr> + <tr> + <th scope="row">DOM 接口</th> + <td>{{domxref("HTMLDataElement")}}</td> + </tr> + </tbody> +</table> + +<h2 id="属性">属性</h2> + +<p>该元素支持<a href="/zh-CN/docs/HTML/Global_attributes">全局属性</a>。</p> + +<dl> + <dt>{{htmlattrdef("value")}}</dt> + <dd>该属性指定元素内容所对应的数据,或者说“机器可读的翻译”。</dd> +</dl> + +<h2 id="示例">示例</h2> + +<p>下面的示例展示了一些产品名称,而且每个名称都和一个产品编码相关联。</p> + +<pre class="brush: html"><p>新产品</p> +<ul> + <li><data value="398">迷你番茄酱</data></li> + <li><data value="399">巨无霸番茄酱</data></li> + <li><data value="400">超级巨无霸番茄酱</data></li> +</ul> +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">备注</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', 'text-level-semantics.html#the-data-element', '<data>')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>No change from {{Spec2('HTML5 W3C')}}</td> + </tr> + <tr> + <td>{{SpecName('HTML5 W3C', 'text-level-semantics.html#the-data-element', '<data>')}}</td> + <td>{{Spec2('HTML5 W3C')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("html.elements.data")}}</p> + +<h2 id="参见">参见</h2> + +<ul> + <li>HTML {{HTMLElement("time")}} 元素。</li> +</ul> |
