@@ -4005,6 +4005,139 @@ blockquote:first-line { font-variant: small-caps; }
4005
4005
<h3 id="font-variant-numeric-prop">
4006
4006
Numerical formatting: the 'font-variant-numeric' property</h3>
4007
4007
4008
+
4009
+ <pre class="propdef">
4010
+ Name : font-variant-numeric
4011
+
4012
+ Value : normal | [ <<numeric-figure-values>> || <<numeric-spacing-values>> || <<numeric-fraction-values>> || ordinal || slashed-zero ] titling-caps
4013
+ Initial : normal
4014
+ Applies to : all elements
4015
+ Inherited : yes
4016
+ Percentages : n/a
4017
+ Computed value : as specified
4018
+ Animation type : discrete
4019
+ </pre>
4020
+
4021
+
4022
+ <p> Specifies control over numerical forms. The example below shows how
4023
+ some of these values can be combined to influence the rendering of
4024
+ tabular data with fonts that support these features. Within normal
4025
+ paragraph text, proportional numbers are used while tabular numbers
4026
+ are used so that columns of numbers line up properly:</p>
4027
+
4028
+ <div class="figure" style="padding: 0; margin: auto;"><img alt="combining number styles" src="images/numberstyles.png"><p class="caption"> Using number styles</p></div>
4029
+
4030
+ <p> Possible combinations:</p>
4031
+
4032
+ <pre class="prod"><dfn id="numeric-figure-values"><var><numeric-figure-values></var></dfn> = [ <span>lining-nums</span> | <span>oldstyle-nums</span> ]</pre>
4033
+
4034
+ <pre class="prod"><dfn id="numeric-spacing-values"><var><numeric-spacing-values></var></dfn> = [ <span>proportional-nums</span> | <span>tabular-nums</span> ]</pre>
4035
+
4036
+ <pre class="prod"><dfn id="numeric-fraction-values"><var><numeric-fraction-values></var></dfn> = [ <span>diagonal-fractions</span> | <span>stacked-fractions</span> ]</pre>
4037
+
4038
+ <p> Individual values have the following meanings:</p>
4039
+
4040
+ <dl dfn-for="font-variant-numeric" dfn-type="value">
4041
+ <dt> <dfn id="font-variant-numeric-normal-value" title="normal!!font-variant-numeric">normal</dfn>
4042
+ <dd> None of the features listed below are enabled.</dd>
4043
+
4044
+ <dt> <dfn>lining-nums</dfn>
4045
+ <dd> Enables display of lining numerals
4046
+ (OpenType feature: <span class="tag"> lnum</span> ).</dd>
4047
+
4048
+ <dt> <dfn>oldstyle-nums</dfn>
4049
+ <dd> Enables display of old-style numerals
4050
+ (OpenType feature: <span class="tag"> onum</span> ).</dd>
4051
+
4052
+ <dt> <dfn>proportional-nums</dfn>
4053
+ <dd> Enables display of proportional numerals
4054
+ (OpenType feature: <span class="tag"> pnum</span> ).</dd>
4055
+
4056
+ <dt> <dfn>tabular-nums</dfn>
4057
+ <dd> Enables display of tabular numerals
4058
+ (OpenType feature: <span class="tag"> tnum</span> ).</dd>
4059
+
4060
+ <dt> <dfn>diagonal-fractions</dfn>
4061
+ <dd> Enables display of lining diagonal fractions
4062
+ (OpenType feature: <span class="tag"> frac</span> ).</dd>
4063
+
4064
+ <div class="featex"><img alt="diagonal fraction example" src="images/frac.png"></div>
4065
+
4066
+ <dt> <dfn>stacked-fractions</dfn>
4067
+ <dd> Enables display of lining stacked fractions
4068
+ (OpenType feature: <span class="tag"> afrc</span> ).</dd>
4069
+
4070
+ <div class="featex"><img alt="stacked fraction example" src="images/afrc.png"></div>
4071
+
4072
+ <dt> <dfn>ordinal</dfn>
4073
+ <dd> Enables display of letter forms used with ordinal numbers
4074
+ (OpenType feature: <span class="tag"> ordn</span> ).</dd>
4075
+
4076
+ <div class="featex"><img alt="ordinals example" src="images/ordinals.png"></div>
4077
+
4078
+ <dt> <dfn>slashed-zero</dfn>
4079
+ <dd> Enables display of slashed zeros
4080
+ (OpenType feature: <span class="tag"> zero</span> ).</dd>
4081
+
4082
+ <div class="featex"><img alt="slashed zero example" src="images/zero.png"></div>
4083
+
4084
+ </dl>
4085
+
4086
+ <div id="ordinal-example" class="example">
4087
+ <p> In the case of 'ordinal' , although ordinal forms
4088
+ are often the same as superscript forms, they are marked up
4089
+ differently.</p>
4090
+ <p> For superscripts, the variant property is only applied
4091
+ to the sub-element containing the superscript:</p>
4092
+ <pre>
4093
+ sup { font-variant-position: super; }
4094
+ x<sup>2</sup>
4095
+ </pre>
4096
+ <p> For ordinals, the variant property is applied
4097
+ to the entire ordinal number rather than
4098
+ just to the suffix (or to the containing paragraph):</p>
4099
+ <pre>
4100
+ .ordinal { font-variant-numeric: ordinal; }
4101
+ <span class="ordinal">17th</span>
4102
+ </pre>
4103
+ <p> In this case only the "th" will appear in ordinal form,
4104
+ the digits will remain unchanged.
4105
+ Depending upon the typographic traditions used in a given language,
4106
+ ordinal forms may differ from superscript forms.
4107
+ In Italian, for example,
4108
+ ordinal forms sometimes include an underline in the ordinal design.</p>
4109
+ </div>
4110
+
4111
+ <div class="example" id="steak-marinade">
4112
+ <p> A simple flank steak marinade recipe,
4113
+ rendered with automatic fractions and old-style numerals:</p>
4114
+
4115
+ <pre> .amount { font-variant-numeric: oldstyle-nums diagonal-fractions; }
4116
+
4117
+ <h4>Steak marinade:</h4>
4118
+ <ul>
4119
+ <li><span class="amount">2</span> tbsp olive oil</li>
4120
+ <li><span class="amount">1</span> tbsp lemon juice</li>
4121
+ <li><span class="amount">1</span> tbsp soy sauce</li>
4122
+ <li><span class="amount">1 1/2</span> tbsp dry minced onion</li>
4123
+ <li><span class="amount">2 1/2</span> tsp italian seasoning</li>
4124
+ <li>Salt &amp; pepper</li>
4125
+ </ul>
4126
+
4127
+ <p>Mix the meat with the marinade
4128
+ and let it sit covered in the refrigerator
4129
+ for a few hours or overnight.</p>
4130
+ </pre>
4131
+
4132
+ <p> Note that the fraction feature
4133
+ is only applied to values
4134
+ not the entire paragraph.
4135
+ Fonts often implement this feature using contextual rules
4136
+ based on the use of the slash ('/' ) character.
4137
+ As such, it's not suitable for use as a paragraph-level style.</p>
4138
+ </div>
4139
+
4140
+
4008
4141
<h3 id="font-variant-alternates-prop">
4009
4142
Alternates and swashes: the 'font-variant-alternates' property</h3>
4010
4143
0 commit comments