aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/font-stretch
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/font-stretch
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/css/font-stretch')
-rw-r--r--files/zh-cn/web/css/font-stretch/index.html156
1 files changed, 156 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/font-stretch/index.html b/files/zh-cn/web/css/font-stretch/index.html
new file mode 100644
index 0000000000..8782c3a629
--- /dev/null
+++ b/files/zh-cn/web/css/font-stretch/index.html
@@ -0,0 +1,156 @@
+---
+title: font-stretch
+slug: Web/CSS/font-stretch
+translation_of: Web/CSS/font-stretch
+---
+<p>{{CSSRef}}</p>
+
+<h2 id="Summary">Summary</h2>
+
+<p><span class="seoSummary"><strong><code>font-stretch</code></strong> 属性为字体定义一个正常或经过伸缩变形的字体外观,这个属性并不会通过伸展/缩小而改变字体的几何外形,如{{cssxref("font-feature-settings")}}和{{cssxref("font-variant")}}属性,它仅仅意味着当有多种字体可供选择时,会为字体选择最适合的大小。</span></p>
+
+<p><img alt="The two 'e' belong to the same fonts. One is condensed, the other normal and can be selected by 'font-stretch'." src="/files/4321/Character_in_same_font_but_one_condensed.png" style="display: block; height: 92px; margin: auto; width: 188px;"></p>
+
+<div class="note cleared">
+<p><strong>Note:</strong><strong> </strong>If the font provides several faces, the one fitting the best with the value of the <code>font-stretch</code> property is chosen. E.g. On OS X, in addition to the more common Bold, Regular, Italic, and BoldItalic faces, the "Helvetica Neue" font proposes a second set of faces with condensed, that is shrunk, characters: Condensed. Browsers supporting <code>font-stretch</code> will use the condensed faces for the value <code>ultra-condensed</code> to <code>semi-condensed</code> and the normal faces for the other (<code>normal</code> and all expanded values).</p>
+<img alt="Font-stretch results with a font having 2 faces, one condensed and one normal." src="/files/4317/Font_stretch_with_2_faces.png" style="display: block; height: 58px; margin: auto; width: 292px;">
+<p>If the font has no condensed or expanded faces, like the default "Times New Roman" on Mac OS, <code>font-stretch</code> will not have any visible effect as the only suitable face will be used in all cases.:<br>
+ <img alt="Font-stretch results with a font having 1 single face." src="/files/4319/Font_stretch_with_1_face.png" style="display: block; height: 58px; margin: auto; width: 258px;"></p>
+</div>
+
+<p>{{cssinfo}}</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="brush:css">/* Keyword values */
+font-stretch: ultra-condensed;
+font-stretch: extra-condensed;
+font-stretch: condensed;
+font-stretch: semi-condensed;
+font-stretch: normal;
+font-stretch: semi-expanded;
+font-stretch: expanded;
+font-stretch: extra-expanded;
+font-stretch: ultra-expanded;
+
+/* Global values */
+font-stretch: inherit;
+font-stretch: initial;
+font-stretch: unset;
+</pre>
+
+<h3 id="Values">Values</h3>
+
+<dl>
+ <dt><code>normal</code></dt>
+ <dd>指定默认字体</dd>
+ <dt><code>semi-condensed</code>, <code>condensed</code>, <code>extra-condensed</code>, <code>ultra-condensed</code></dt>
+ <dd><font face="Consolas, Liberation Mono, Courier, monospace">小于默认字体,其中ultra-condensed是缩的最小的字体</font></dd>
+ <dt><code>semi-expanded</code>, <code>expanded</code>, <code>extra-expanded</code>, <code>ultra-expanded</code></dt>
+ <dd>大于默认字体的值</dd>
+</dl>
+
+<h3 id="Interpolation">Interpolation</h3>
+
+<p>Font stretch values are interpolated in discrete steps. The interpolation happens as though the ordered values are equally spaced real numbers; the result is rounded to the nearest value, with values exactly halfway between two values rounded towards the later value, that is the most expanded one.</p>
+
+<h3 id="Formal_syntax">Formal syntax</h3>
+
+<pre class="syntaxbox">{{csssyntax}}</pre>
+
+<h2 id="Example">Example</h2>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html">&lt;div class="ultra stretch"&gt; This is text with the font extremely expanded&lt;/div&gt;
+&lt;div class="stretch"&gt; This is text with the font stretched&lt;/div&gt;
+&lt;div class="normal"&gt; This is text without font stretching&lt;/div&gt;
+&lt;div class="condensed"&gt; This is text with the font condensed&lt;/div&gt;
+&lt;div class="ultra condensed"&gt; This is text with the font extremely condensed&lt;/div&gt;</pre>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css">.ultra.stretch{font-stretch: ultra-expanded;}
+.stretch {font-stretch: expanded;}
+.normal {font-stretch: normal;}
+.condensed {font-stretch: condensed;}
+.ultra.condensed {font-stretch: ultra-condensed;}</pre>
+
+<h3 id="Result">Result</h3>
+
+<p>{{ EmbedLiveSample('Example', '500', '', '', 'Web/CSS/font-stretch') }}</p>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{ SpecName('CSS3 Fonts', '#propdef-font-stretch', 'font-stretch') }}</td>
+ <td>{{ Spec2('CSS3 Fonts') }}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>The CSS property <code>font-stretch</code> was initially defined in CSS 2, but dropped in CSS 2.1 due to lack of implementation experience. It has been newly defined in CSS 3.</p>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>48.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{ CompatGeckoDesktop("9.0") }}</td>
+ <td>9.0</td>
+ <td>35.0</td>
+ <td>{{ CompatNo() }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatNo() }}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{ CompatGeckoMobile("9.0") }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatNo() }}</td>
+ <td>{{ CompatNo() }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>