diff options
Diffstat (limited to 'files/zh-cn/web/css/font-variant/index.html')
-rw-r--r-- | files/zh-cn/web/css/font-variant/index.html | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/font-variant/index.html b/files/zh-cn/web/css/font-variant/index.html new file mode 100644 index 0000000000..8b66cb1f50 --- /dev/null +++ b/files/zh-cn/web/css/font-variant/index.html @@ -0,0 +1,121 @@ +--- +title: font-variant +slug: Web/CSS/font-variant +tags: + - CSS + - CSS Fonts + - CSS Property + - Reference +translation_of: Web/CSS/font-variant +--- +<div>{{CSSRef}}</div> + +<p><strong>font-variant</strong> 属性是{{cssxref("font-variant-caps")}}, {{cssxref("font-variant-numeric")}}, {{cssxref("font-variant-alternates")}}, {{cssxref("font-variant-ligatures")}}, {{cssxref("font-variant-east-asian")}}等属性的简写。你也可以使用简写 {{cssxref("font")}} 设定<code>font-variant</code>在CSS Level 2 (Revision 1)中的值(即<code>normal</code> 或 <code>small-caps</code>)。</p> + +<div>{{EmbedInteractiveExample("pages/css/font-variant.html")}}</div> + + + +<h2 id="语法">语法</h2> + +<pre class="brush:css no-line-numbers">font-variant: small-caps; +font-variant: common-ligatures small-caps; + +/* Global values */ +font-variant: inherit; +font-variant: initial; +font-variant: unset; +</pre> + +<h3 id="值">值</h3> + +<dl> + <dt><code>normal</code></dt> + <dd>规定一个常规(normal)字型;每个非简写的属性的初始值都是normal。属于 <code>font-variant</code> 的非简写属性有:{{cssxref("font-variant-caps")}}, {{cssxref("font-variant-numeric")}}, {{cssxref("font-variant-alternates")}}, {{cssxref("font-variant-ligatures")}} 和 {{cssxref("font-variant-east-asian")}}。</dd> + <dt><code>none</code></dt> + <dd>将{{cssxref("font-variant-ligatures")}}设定为 <code>none</code> ,将其他非简写属性的值设定为初始值<code>normal</code>。</dd> + <dt><code><common-lig-values></code>, <code><discretionary-lig-values></code>, <code><historical-lig-values></code>, <code><contextual-alt-values></code></dt> + <dd>规定与{{cssxref("font-variant-ligatures")}}属性相关的关键字,可能的值包括: <code>common-ligatures</code>, <code>no-common-ligatures</code>, <code>discretionary-ligatures</code>, <code>no-discretionary-ligatures</code>, <code>historical-ligatures</code>, <code>no-historical-ligatures</code>, <code>contextual</code> 和 <code>no-contextual</code>。</dd> + <dt><code>stylistic()</code>, <code>historical-forms</code>, <code>styleset()</code>, <code>character-variant()</code>, <code>swash()</code>, <code>ornaments()</code>, <code>annotation()</code></dt> + <dd>规定与{{cssxref("font-variant-alternates")}}属性相关的关键字和函数。</dd> + <dt><code>small-caps</code>, <code>all-small-caps</code>, <code>petite-caps</code>, <code>all-petite-caps</code>, <code>unicase</code>, <code>titling-caps</code></dt> + <dd>规定与{{cssxref("font-variant-caps")}} 属性相关的关键字和函数。</dd> + <dt><code><numeric-figure-values></code>, <code><numeric-spacing-values></code>, <code><numeric-fraction-values></code>, <code>ordinal</code>, <code>slashed-zero</code></dt> + <dd>规定与{{cssxref("font-variant-alternates")}}属性相关的关键字,可能的值包括:<code>lining-nums</code>, <code>oldstyle-nums</code>, <code>proportional-nums</code>, <code>tabular-nums</code>, <code>diagonal-fractions</code>, <code>stacked-fractions</code>, <code>ordinal</code> 和 <code>slashed-zero</code>。</dd> + <dt><code><east-asian-variant-values></code>, <code><east-asian-width-values></code>, <code>ruby</code></dt> + <dd>规定与{{cssxref("font-variant-east-asian")}}属性相关的关键字,可能的值包括:<code>jis78</code>, <code>jis83</code>, <code>jis90</code>, <code>jis04</code>, <code>simplified</code>, <code>traditional</code>, <code>full-width</code>, <code>proportional-width</code>, <code>ruby</code>。</dd> + <dt> + <h3 id="正式语法">正式语法</h3> + </dt> +</dl> + +<pre class="syntaxbox">{{csssyntax}}</pre> + +<h2 id="示例">示例</h2> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html"><p class="normal">Firefox rocks!</p> +<p class="small">Firefox rocks!</p> +</pre> + +<h3 id="CSS">CSS</h3> + +<pre class="brush: css">p.normal { + font-variant: normal; +} +p.small { + font-variant: small-caps; +} +</pre> + +<h3 id="结果">结果</h3> + +<p><iframe class="live-sample-frame sample-code-frame" frameborder="0" id="frame_Example" src="https://mdn.mozillademos.org/en-US/docs/Web/CSS/font-variant$samples/Example?revision=1598093"></iframe></p> + +<h2 id="规范">规范</h2> + +<p>{{cssinfo}}</p> + +<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-variant', 'font-variant')}}</td> + <td>{{Spec2('CSS3 Fonts')}}</td> + <td>Made it a shorthand of the new <code>font-variant-*</code> properties.</td> + </tr> + <tr> + <td>{{SpecName('CSS2.1', 'fonts.html#propdef-font-variant', 'font-variant')}}</td> + <td>{{Spec2('CSS2.1')}}</td> + <td>No change</td> + </tr> + <tr> + <td>{{SpecName('CSS1', '#font-variant', 'font-variant')}}</td> + <td>{{Spec2('CSS1')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> + +<div> + + +<p>{{Compat("css.properties.font-variant")}}</p> +</div> + +<h2 id="参见">参见</h2> + +<ul> + <li>{{cssxref("text-transform")}}</li> + <li>{{cssxref("text-combine-upright")}}</li> + <li>{{cssxref("text-orientation")}}</li> +</ul> |