aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/html/element/dfn/index.html
blob: a13ebe63f246ae501086a1bb867754b7cc3c26de (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
---
title: <dfn>
slug: Web/HTML/Element/dfn
translation_of: Web/HTML/Element/dfn
---
<h2 id="摘要">摘要</h2>

<p><em>HTML 定义元素</em> (<strong>&lt;dfn&gt;</strong>) 表示术语的一个定义。</p>

<div class="note"><strong>HTML5 使用说明:</strong>

<ul>
 <li><code>&lt;dfn&gt;</code> 元素标记了被定义的术语;术语定义应当在 {{HTMLElement("p")}}, {{HTMLElement("section")}}或定义列表 (通常是{{HTMLElement("dt")}}, {{HTMLElement("dd")}} 对) 中给出。</li>
 <li>被定义术语的值由下列规则确定:
  <ol>
   <li>如果 <code>&lt;dfn&gt;</code> 元素有一个 <code><strong>title</strong></code> 属性,那么该术语的值就是该属性的值。</li>
   <li>否则,如果它仅包含一个 {{HTMLElement("abbr")}} 元素,该元素拥有 {{htmlattrxref("title", "abbr")}} 属性,那么该术语的值就是该属性的值。</li>
   <li>否则,<code>&lt;dfn&gt;</code> 元素的文本内容就是该术语的值。</li>
  </ol>
 </li>
</ul>
</div>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row"><a href="/zh-CN/docs/Web/Guide/HTML/Content_categories" title="HTML/Content_categories">内容分类</a></th>
   <td><a href="/zh-CN/docs/Web/Guide/HTML/Content_categories#Flow_content" title="HTML/Content categories#Flow content">Flow content</a>, <a href="/zh-CN/docs/Web/Guide/HTML/Content_categories#Phrasing_content" title="HTML/Content categories#Phrasing content">phrasing content</a>, palpable content.</td>
  </tr>
  <tr>
   <th scope="row">允许的内容</th>
   <td><a href="/zh-CN/docs/Web/Guide/HTML/Content_categories#Phrasing_content" title="HTML/Content_categories#Phrasing_content">Phrasing content</a>, but no {{HTMLElement("dfn")}} element must be a descendant.</td>
  </tr>
  <tr>
   <th scope="row">标签省略</th>
   <td>{{no_tag_omission}}</td>
  </tr>
  <tr>
   <th scope="row">允许的父元素</th>
   <td>Any element that accepts <a href="/zh-CN/docs/Web/Guide/HTML/Content_categories#Phrasing_content" title="HTML/Content_categories#Phrasing_content">phrasing content</a>.</td>
  </tr>
  <tr>
   <th scope="row">DOM 接口</th>
   <td>{{domxref("HTMLElement")}}</td>
  </tr>
 </tbody>
</table>

<h2 id="属性">属性</h2>

<p><span style="line-height: 21px;">该元素包括 </span><a href="https://developer.mozilla.org/en-US/docs/HTML/Global_attributes" style="line-height: 21px;" title="HTML/Global attributes">全局属性</a></p>

<p>在 HTML5 中,<code><strong>title</strong></code> 属性拥有特殊含义,见上文。</p>

<h2 id="示例">示例</h2>

<p>下列示例是合法的 HTML5。</p>

<pre class="brush: html">&lt;!-- Define "The Internet" --&gt;
&lt;p&gt;&lt;dfn id="def-internet"&gt;The Internet&lt;/dfn&gt; is a global system of interconnected networks that use the Internet Protocol Suite (TCP/IP) to serve billions of users worldwide.&lt;/p&gt;
</pre>

<p>在同一文档的后面:</p>

<pre class="brush: html">&lt;dl&gt;
  &lt;!-- Define "World-Wide Web" and reference definition for "the Internet" --&gt;
  &lt;dt&gt;
    &lt;dfn&gt;
      &lt;abbr title="World-Wide Web"&gt;WWW&lt;/abbr&gt;
    &lt;/dfn&gt;
  &lt;/dt&gt;
  &lt;dd&gt;The World-Wide Web (WWW) is a system of interlinked hypertext documents accessed on &lt;a href="#def-internet"&gt;the Internet&lt;/a&gt;.&lt;/dd&gt;
&lt;/dl&gt;
</pre>

<h3 id="结果">结果</h3>

<p>{{ EmbedLiveSample('Examples', '600', '150', '', 'Web/HTML/Element/dfn') }}</p>

<h2 id="Specifications" name="Specifications">标准</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-dfn-element', '&lt;dfn&gt;')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', 'text-level-semantics.html#the-dfn-element', '&lt;dfn&gt;')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('HTML4.01', 'struct/text.html#h-9.2.1', '&lt;dfn&gt;')}}</td>
   <td>{{Spec2('HTML4.01')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>

{{Compat("html.elements.dfn")}}

<h2 id="相关链接">相关链接</h2>

<ul>
 <li>定义列表的相关元素:{{HTMLElement("dl")}}, {{HTMLElement("dt")}}, {{HTMLElement("dd")}}</li>
 <li>{{HTMLElement("abbr")}}</li>
</ul>

<p>{{HTMLRef}}</p>