--- title: font-variant slug: Web/CSS/font-variant tags: - CSS - CSS Fonts - CSS Property - Reference translation_of: Web/CSS/font-variant ---
font-variant 属性是{{cssxref("font-variant-caps")}}, {{cssxref("font-variant-numeric")}}, {{cssxref("font-variant-alternates")}}, {{cssxref("font-variant-ligatures")}}, {{cssxref("font-variant-east-asian")}}等属性的简写。你也可以使用简写 {{cssxref("font")}} 设定font-variant
在CSS Level 2 (Revision 1)中的值(即normal
或 small-caps
)。
font-variant: small-caps; font-variant: common-ligatures small-caps; /* Global values */ font-variant: inherit; font-variant: initial; font-variant: unset;
normal
font-variant
的非简写属性有:{{cssxref("font-variant-caps")}}, {{cssxref("font-variant-numeric")}}, {{cssxref("font-variant-alternates")}}, {{cssxref("font-variant-ligatures")}} 和 {{cssxref("font-variant-east-asian")}}。none
none
,将其他非简写属性的值设定为初始值normal
。<common-lig-values>
, <discretionary-lig-values>
, <historical-lig-values>
, <contextual-alt-values>
common-ligatures
, no-common-ligatures
, discretionary-ligatures
, no-discretionary-ligatures
, historical-ligatures
, no-historical-ligatures
, contextual
和 no-contextual
。stylistic()
, historical-forms
, styleset()
, character-variant()
, swash()
, ornaments()
, annotation()
small-caps
, all-small-caps
, petite-caps
, all-petite-caps
, unicase
, titling-caps
<numeric-figure-values>
, <numeric-spacing-values>
, <numeric-fraction-values>
, ordinal
, slashed-zero
lining-nums
, oldstyle-nums
, proportional-nums
, tabular-nums
, diagonal-fractions
, stacked-fractions
, ordinal
和 slashed-zero
。<east-asian-variant-values>
, <east-asian-width-values>
, ruby
jis78
, jis83
, jis90
, jis04
, simplified
, traditional
, full-width
, proportional-width
, ruby
。{{csssyntax}}
<p class="normal">Firefox rocks!</p> <p class="small">Firefox rocks!</p>
p.normal { font-variant: normal; } p.small { font-variant: small-caps; }
{{cssinfo}}
Specification | Status | Comment |
---|---|---|
{{SpecName('CSS3 Fonts', '#propdef-font-variant', 'font-variant')}} | {{Spec2('CSS3 Fonts')}} | Made it a shorthand of the new font-variant-* properties. |
{{SpecName('CSS2.1', 'fonts.html#propdef-font-variant', 'font-variant')}} | {{Spec2('CSS2.1')}} | No change |
{{SpecName('CSS1', '#font-variant', 'font-variant')}} | {{Spec2('CSS1')}} | Initial definition |
{{Compat("css.properties.font-variant")}}