Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style fontSizeAdjust Property

Style fontSizeAdjust Property

Style Object Reference The Style object


Definition and Usage

The fontSizeAdjust property sets or returns the aspect value of the text font.

All fonts have aspect value, which is the size difference between the lowercase letter "x" and the uppercase letter "X".

When the first-choice font is unavailable, the fontSizeAdjust property gives you better control over the font size. When a font is unavailable, the browser uses the second specified font. This may cause a change in font size. To prevent this, use this property.

When the browser knows the aspect value of the first-choice font, it can compute the font size to use when displaying the text with the second-choice font.

Syntax

Sets the fontSizeAdjust property:

Object.style.fontSizeAdjust="none|

value

|inherit"

Returns the fontSizeAdjust property:

Object.style.fontSizeAdjust

Value Description
none Default. Do not preserve the x-height of the first-choice font.
value Preserves the x-height of the first-choice font and calculates the aspect value ratio of the font.
 使用的公式:首选字体的字体尺寸 * (第一选择字体的 aspect 值 / 可用字体的 aspect 值) = 可用字体的字体尺寸       

   

 实例:如果 14px 的 Verdana(aspect 值是 0.58)不可用,但是某个可用的字体(Times New Roman)的 aspect 值是 0.46,那么替代字体的尺寸将是 14*(0.58/0.46) = 17.65px。 |

| inherit | The fontSizeAdjust property value is inherited from the parent element. |


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Only Firefox supports the fontSizeAdjust property.


Example

Example

Adjust the font size:

Runoob Tutorial(runoob.com)

This is some text


Try it »


Style Object Reference The Style object