📄 fonts.html
字号:
</table></dl></div><P> The <a href="fonts.html#propdef-font-weight" class="noxref"><span class="propinst-font-weight">'font-weight'</span></a>property specifies the <span>weight</span> of the font. Values have the followingmeanings:</p><dl><dt><strong>100 to 900</strong><dd>These valuesform an ordered sequence, where each number indicates a weight that isat least as dark as its predecessor.<dt><strong>normal</strong><dd>Same as '400'.<dt><strong>bold</strong><dd>Same as '700'.<dt><strong>bolder</strong><dd>Specifies the next weight that is assigned to a font that is darkerthan the inherited one. If there is no such weight, it simply resultsin the next darker numerical value (and the font remains unchanged),unless the inherited value was '900', in which case the resultingweight is also '900'.<dt><strong>lighter</strong><dd>Specifies the next weight that is assigned to a font that is lighterthan the inherited one. If there is no such weight, it simply resultsin the next lighter numerical value (and the font remains unchanged),unless the inherited value was '100', in which case the resultingweight is also '100'.</dl><div class="example"><P style="display:none">Example(s):</P><PRE>P { font-weight: normal } /* 400 */H1 { font-weight: 700 } /* bold */BODY { font-weight: 400 }STRONG { font-weight: bolder } /* 500 if available */</PRE></div><P>Child elements inherit the <a href="cascade.html#computed-value">computed value</a> of the weight.<div class="propdef"><dl><dt><span class="index-def" title="'font-stretch'"><a name="propdef-font-stretch" class="propdef-title"><strong>'font-stretch'</strong></a></span><dd><table class="propinfo" cellspacing=0 cellpadding=0><tr valign=baseline><td><em>Value:</em> <td>normal | wider | narrower | ultra-condensed | extra-condensed |condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a><tr valign=baseline><td><em>Initial:</em> <td>normal<tr valign=baseline><td><em>Applies to:</em> <td>all elements<tr valign=baseline><td><em>Inherited:</em> <td>yes<tr valign=baseline><td><em>Percentages:</em> <td>N/A<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#visual-media-group" class="noxref">visual</a></table></dl></div><P> The <a href="fonts.html#propdef-font-stretch" class="noxref"><span class="propinst-font-stretch">'font-stretch'</span></a>property selects a normal, condensed, or extended face from a fontfamily. Absolute keyword values have the following ordering, fromnarrowest to widest :</p><ol> <li>ultra-condensed <li>extra-condensed <li>condensed <li>semi-condensed <li>normal <li>semi-expanded <li>expanded <li>extra-expanded <li>ultra-expanded</ol><p>The relative keyword 'wider' sets the value to the next expandedvalue above the inherited value (while not increasing it above'ultra-expanded'); the relative keyword 'narrower' sets the value tothe next condensed value below the inherited value (while notdecreasing it below 'ultra-condensed'). <H3>15.2.4 <a name="font-size-props">Font size</a>: the <a href="fonts.html#propdef-font-size" class="noxref"><spanclass="propinst-font-size">'font-size'</span></a>and <a href="fonts.html#propdef-font-size-adjust" class="noxref"><span class="propinst-font-size-adjust">'font-size-adjust'</span></a>properties</H3><div class="propdef"><dl><dt><span class="index-def" title="'font-size'"><a name="propdef-font-size" class="propdef-title"><strong>'font-size'</strong></a></span><dd><table class="propinfo" cellspacing=0 cellpadding=0><tr valign=baseline><td><em>Value:</em> <td><a href="fonts.html#value-def-absolute-size" class="noxref"><span class="value-inst-absolute-size"><absolute-size></span></a> | <a href="fonts.html#value-def-relative-size" class="noxref"><span class="value-inst-relative-size"><relative-size></span></a> | <a href="syndata.html#value-def-length" class="noxref"><span class="value-inst-length"><length></span></a> | <a href="syndata.html#value-def-percentage" class="noxref"><span class="value-inst-percentage"><percentage></span></a> | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a><tr valign=baseline><td><em>Initial:</em> <td>medium<tr valign=baseline><td><em>Applies to:</em> <td>all elements<tr valign=baseline><td><em>Inherited:</em> <td>yes, the computed value is inherited<tr valign=baseline><td><em>Percentages:</em> <td>refer to parent element's font size<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#visual-media-group" class="noxref">visual</a></table></dl></div><P>This property describes the size of the font when set solid.Values have the following meanings:</p><DL> <DT><a name="x18"><span class="index-def" title="<absolute-size>::definition of"> <strong><absolute-size></strong></span></a> <DD> An <a name="value-def-absolute-size"class="value-def"><absolute-size></a> keyword refers to an entryin a table of font sizes computed and kept by the user agent. Possible valuesare: <P> [ xx-small | x-small | small | medium | large | x-large | xx-large ] <P>On a computer screen a scaling factor of 1.2 is suggested between adjacent indexes; if the 'medium' font is 12pt, the 'large' font could be 14.4pt. Different media may need different scaling factors. Also, the user agent should take the quality and availability of fonts into account when computing the table. The table may be different from one font family to another.<p class="note"><em><strong>Note.</strong> In CSS1, the suggestedscaling factor between adjacent indexes was 1.5 which user experienceproved to be too large.</em></P> <DT><a name="x19"><span class="index-def" title="<relative-size>::definitionof"><strong><relative-size></strong></span></a> <DD> A <a name="value-def-relative-size" class="value-def"><relative-size></a> keyword is interpreted relative to the table of font sizes and the font size of the parent element. Possible values are: <P> [ larger | smaller ] <P> For example, if the parent element has a font size of 'medium', a value of 'larger' will make the font size of the current element be 'large'. If the parent element's size is not close to a table entry, the user agent is free to interpolate between table entries or round off to the closest one. The user agent may have to extrapolate table values if the numerical value goes beyond the keywords. <DT><span class="index-inst" title="<length>"><a name="x20" href="syndata.html#value-def-length" class="noxref"><span class="value-inst-length"><strong><length></strong></span></a></span> <DD>A length value specifies an absolute font size (that is independent of the user agent's font table). Negative lengths are illegal. <DT><span class="index-inst" title="<percentage>"><a name="x21" href="syndata.html#value-def-percentage" class="noxref"><span class="value-inst-percentage"><strong><percentage></strong> </span></a></span> <DD>A percentage value specifies an absolute font size relative to the parent element's font size. Use of percentage values, or values in 'em's, leads to more robust and cascadable style sheets. </DL><P>The <a href="cascade.html#actual-value">actual value</a> ofthis property may differ from the <ahref="cascade.html#computed-value">computed value</a> due a numerical value on 'font-size-adjust' and the unavailability of certain font sizes. <p>Child elements inherit the computed <a href="fonts.html#propdef-font-size" class="noxref"><span class="propinst-font-size">'font-size'</span></a> value (otherwise, the effect of <a href="fonts.html#propdef-font-size-adjust" class="noxref"><span class="propinst-font-size-adjust">'font-size-adjust'</span></a> would compound).<div class="example"><P style="display:none">Example(s):</P><P><PRE>P { font-size: 12pt; }BLOCKQUOTE { font-size: larger }EM { font-size: 150% }EM { font-size: 1.5em }</PRE></div><div class="propdef"><dl><dt><span class="index-def" title="'font-size-adjust'"><a name="propdef-font-size-adjust" class="propdef-title"><strong>'font-size-adjust'</strong></a></span><dd><table class="propinfo" cellspacing=0 cellpadding=0><tr valign=baseline><td><em>Value:</em> <td><a href="syndata.html#value-def-number" class="noxref"><span class="value-inst-number"><number></span></a> | none | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a><tr valign=baseline><td><em>Initial:</em> <td>none<tr valign=baseline><td><em>Applies to:</em> <td>all elements<tr valign=baseline><td><em>Inherited:</em> <td>yes<tr valign=baseline><td><em>Percentages:</em> <td>N/A<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#visual-media-group" class="noxref">visual</a></table></dl></div><P>In <a name="x23"><span class="index-inst" title="bicameral">bicameral</span></a>scripts, the subjective apparent size and legibility of a font areless dependent on their <a href="fonts.html#propdef-font-size" class="noxref"><spanclass="propinst-font-size">'font-size'</span></a> value than on the valueof their <a href="fonts.html#descdef-x-height" class="noxref"><span class="descinst-x-height">'x-height'</span></a>, or, moreusefully, on the ratio of these two values, called the <a name="x24"><spanclass="index-def" title="aspect value"><dfn>aspect value</dfn></span></a>(font size divided by x-height). The higher the aspect value, the morelikely it is that a font at smaller sizes will be legible. Inversely,faces with a lower aspect value will become illegible more rapidlybelow a given threshold size than faces with a higher aspectvalue. Straightforward font substitution that relies on font sizealone may lead to illegible characters.<P>For example, the popular font Verdana has an aspect value of 0.58;when Verdana's font size 100 units, its x-height is 58 units. Forcomparison, Times New Roman has an aspect value of 0.46. Verdana willtherefore tend to remain legible at smaller sizes than Times NewRoman. Conversely, Verdana will often look 'too big' if substitutedfor Times New Roman at a chosen size.<P>This property allows authors to specify an aspect value for anelement that will preserve the x-height of the first choice font inthe substitute font. Values have the following meanings:<dl><dt><strong>none</strong><dd>Do not preserve the font's x-height.<dt><span class="index-inst" title="<number>"><a name="x25" href="syndata.html#value-def-number" class="noxref"><spanclass="value-inst-number"><strong><number></strong></span></a></span><dd>Specifies the aspect value. The number refers to the aspect valueof the first choice font. The scaling factor for available fonts iscomputed according to the following formula:<pre> y(a/a') = c</pre><P>where:</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -