110 lines
6.6 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<article id="wikiArticle">
<div> <div class="blockIndicator deprecated deprecatedHeader">
<p><strong><span class="icon-only-inline" title="This is an obsolete API and is no longer guaranteed to work."><i class="icon-trash"> </i></span> 已废弃</strong><br/>该特性已经从 Web 标准中删除,虽然一些浏览器目前仍然支持它,但也许会在未来的某个时间停止支持,请尽量不要使用该特性。</p>
</div></div>
<p><strong><code>big()</code></strong>方法的作用是创建一个使字符串显示大号字体的<a href="/zh-CN/docs/Web/HTML/Element/big" title="The HTML Big Element (&lt;big&gt;) 会使字体加大一号(例如从小号(small)到中号(medium),从大号(large)到加大(x-large)),最大不超过浏览器的最大字体。"><code>&lt;big&gt;</code></a>标签。</p>
<div class="note">
<p><strong>使用说明:</strong>  &lt;big&gt; 元素在<a href="/en-US/docs/Web/Guide/HTML/HTML5">HTML5</a>中已经被移除了不应该再使用它。 取而代之的是web开发人员应该使用<a href="/en-US/docs/Web/CSS">CSS</a> 属性。</p>
</div>
<h2 id="语法">语法</h2>
<pre><code class="language-javascript"><code><var>str</var>.big()</code></code></pre>
<h3 id="返回值">返回值</h3>
<p>带有 <a href="/zh-CN/docs/Web/HTML/Element/big" title="The HTML Big Element (&lt;big&gt;) 会使字体加大一号(例如从小号(small)到中号(medium),从大号(large)到加大(x-large)),最大不超过浏览器的最大字体。"><code>&lt;big&gt;</code></a>标签的字符串。</p>
<h2 id="描述">描述</h2>
<p><code>big()</code> 方法会将一个字符串嵌入到<code>&lt;big&gt;标签中:</code> <code>"&lt;big&gt;str&lt;/big&gt;"。</code></p>
<h2 id="示例">示例</h2>
<h3 id="使用big()函数"><code><font face="Open Sans, Arial, sans-serif">使用</font>big()函数</code></h3>
<p>下面的例子使用了字符串方法来改变一个字符串的字体大小:</p>
<pre><code class="language-javascript">var worldString = 'Hello, world';
console.log(worldString.small()); // &lt;small&gt;Hello, world&lt;/small&gt;
console.log(worldString.big()); // &lt;big&gt;Hello, world&lt;/big&gt;
console.log(worldString.fontsize(7)); // &lt;fontsize=7&gt;Hello, world&lt;/fontsize&gt;
</code></pre>
<p>使用 <a href="/zh-CN/docs/Web/API/HTMLElement/style" title="HTMLElement.style 属性返回一个 CSSStyleDeclaration 对象表示元素的 内联style 属性attribute但忽略任何样式表应用的属性。 通过 style 可以访问的 CSS 属性列表可以查看 CSS Properties Reference。"><code>element.style</code></a> 对象你能更加一般地获得和操作该元素的style属性比如</p>
<pre><code class="language-javascript">document.getElementById('yourElemId').style.fontSize = '2em';
</code></pre>
<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><a class="external" href="https://www.ecma-international.org/ecma-262/6.0/#sec-string.prototype.big" hreflang="en" lang="en" rel="noopener">ECMAScript 2015 (6th Edition, ECMA-262)<br/><small lang="zh-CN">String.prototype.big</small></a></td>
<td><span class="spec-Standard">Standard</span></td>
<td>初始定义。 在JavaScript 1.0中实现。在规范性附件B中定义了用于Web浏览器的附加ECMAScript 特性。</td>
</tr>
<tr>
<td><a class="external" href="https://tc39.github.io/ecma262/#sec-string.prototype.big" hreflang="en" lang="en" rel="noopener">ECMAScript Latest Draft (ECMA-262)<br/><small lang="zh-CN">String.prototype.big</small></a></td>
<td><span class="spec-Draft">Draft</span></td>
<td>规范性附件B中定义了用于Web浏览器的附加ECMAScript 特性。</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<div><div class="blockIndicator warning"><strong><a class="external" href="https://github.com/mdn/browser-compat-data" rel="noopener">We're converting our compatibility data into a machine-readable JSON format</a></strong>.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
<strong><a class="new" href="/zh-CN/docs/MDN/Contribute/Structures/Compatibility_tables" rel="nofollow">Find out how you can help!</a></strong></div>
<div class="htab">
<a id="AutoCompatibilityTable" name="AutoCompatibilityTable"></a>
<ul>
<li class="selected"><a>Desktop</a></li>
<li><a>Mobile</a></li>
</ul>
</div></div>
<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><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
<td>1.0 (1.7 or earlier)</td>
<td><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
<td><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
<td><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></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><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
<td><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
<td>1.0 (1.0)</td>
<td><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
<td><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
<td><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
</tr>
</tbody>
</table>
</div>
<h2 id="相关链接">相关链接</h2>
<ul>
<li><a href="Reference/Global_Objects/String/fontsize" title="The fontsize() method creates a &lt;font&gt; HTML element that causes a string to be displayed in the specified font size."><code>String.prototype.fontsize()</code></a></li>
<li><a href="Reference/Global_Objects/String/small" title="small() 方法的作用是创建一个使字符串显示小号字体的 &lt;small&gt; 标签。"><code>String.prototype.small()</code></a></li>
</ul>
</article>