aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/html/element/small/index.html
blob: 33977ad1c6e4ff00c7ca88f004a1f15a110b6b35 (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
---
title: <small>
slug: Web/HTML/Element/small
tags:
  - HTML
  - 元素
translation_of: Web/HTML/Element/small
---
<div>{{HTMLRef}}</div>

<p>HTML 中的&lt;small&gt;元素將使文本的字体变小一号。(例如从大变成中等,从中等变成小,从小变成超小)。在 HTML5 中,除了它的样式含义,这个元素被重新定义为表示边注释和附属细则,包括版权和法律文本。</p>

<div>{{EmbedInteractiveExample("pages/tabbed/small.html", "tabbed-shorter")}}</div>

<p class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples </a> and send us a pull request.</p>

<table>
 <tbody>
  <tr>
   <th scope="row">内容分类</th>
   <td><a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Flow_content">流式内容</a>, <a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Phrasing_content">短语内容</a></td>
  </tr>
  <tr>
   <th scope="row">允许的内容</th>
   <td><a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Phrasing_content">短语内容</a></td>
  </tr>
  <tr>
   <th scope="row">标签省略</th>
   <td>无,必须拥有起始和结束标签</td>
  </tr>
  <tr>
   <th scope="row">允许的父元素</th>
   <td>接受<a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Phrasing_content">短语内容</a>或者<a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Flow_content">流式内容</a>的任何元素。</td>
  </tr>
  <tr>
   <th scope="row">允许的 ARIA 角色</th>
   <td>任意</td>
  </tr>
  <tr>
   <th scope="row">DOM 接口</th>
   <td>{{domxref("HTMLElement")}}</td>
  </tr>
 </tbody>
</table>

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

<p>这个元素只有全局属性。</p>

<h2 id="DOM_Interface" name="DOM_Interface">DOM 接口</h2>

<p>这个元素实现 {{domxref("HTMLElement")}}接口。</p>

<div class="note">
<p><strong>接口实现注解:</strong>直到 Gecko 1.9.2,Firefox 为这个元素实现了 {{domxref("HTMLSpanElement")}}接口。</p>
</div>

<h2 id="Example_1" name="Example_1">例子</h2>

<h3 id="例子1">例子 1</h3>

<pre class="brush: html">&lt;p&gt;This is the first sentence.  &lt;small&gt;This whole sentence is in small letters.&lt;/small&gt;&lt;/p&gt;
</pre>

<h4 id="Result" name="Result">结果</h4>

<p>This is the first sentence. <small>This whole sentence is in small letters.</small></p>

<h3 id="Example_2" name="Example_2">例子 2 (CSS 替代)</h3>

<pre class="brush: html">&lt;p&gt;This is the first sentence. &lt;span style="font-size:0.8em"&gt;This whole sentence is in small letters.&lt;/span&gt;&lt;/p&gt;
</pre>

<h4 id="Result_2" name="Result_2">结果 </h4>

<p>This is the first sentence. <span style="font-size: 0.8em;">This whole sentence is in small letters.</span></p>

<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('HTML5 W3C', 'text-level-semantics.html#the-small-element', '&lt;small&gt;')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td></td>
  </tr>
  <tr>
   <td>{{SpecName('HTML4.01', '/present/graphics.html#edef-SMALL', '&lt;small&gt;')}}</td>
   <td>{{Spec2('HTML4.01')}}</td>
   <td></td>
  </tr>
 </tbody>
</table>

<h2 id="Notes" name="Notes">注意事项</h2>

<p>尽管<span style="font-family: Courier New;"> &lt;small&gt;</span> 元素,<span style="font-family: Courier New;">&lt;b&gt; 元素</span>和 <span style="font-family: Courier New;">&lt;i&gt;</span> 元素被认为违反了结构和样式分离的原则,但是在 HTML5 中是允许使用这三个元素的。读者应该自行判断使用 &lt;small&gt; 还是 CSS。</p>

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

<p>{{Compat("html.elements.small")}}</p>



<h2 id="See_also" name="See_also">另请参考</h2>

<ul>
 <li>{{ HTMLElement("b") }}</li>
 <li>{{ HTMLElement("font") }}</li>
 <li>{{ HTMLElement("style") }}</li>
 <li>HTML 4.01 规范: <a class="external" href="http://www.w3.org/TR/html4/present/graphics.html#h-15.2">字体样式</a></li>
</ul>