Style fontSizeAdjust Property

Definition and Usage

fontSizeAdjust This property sets or returns the aspect value of the text's font.

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

When the preferred font is not availablefontSizeAdjust This property allows you to better control the font size. When the font is not available, the browser uses the second specified font. This can cause a significant change in font size. To prevent this, use this property.

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

See also:

CSS Tutorial:CSS Font

CSS Reference Manual:font-size attribute

HTML DOM Reference Manual:font property

Example

Adjust font size:

document.getElementById("myP").style.fontSizeAdjust = "0.58";

Try it yourself

Syntax

Return fontSizeAdjust property:

object.style.fontSizeAdjust

Set fontSizeAdjust property:

object.style.fontSizeAdjust = "none|number|initial|inherit"

Attribute Value

Value Description
none Default value. Does not adjust font size.
number

Retains the x-height of the preferred font and calculates the font's aspect ratio.

The formula used: preferred font's font-size * (preferred font's aspect value / available font's aspect value) = font-size used for the available font

Example: If 14px Verdana (aspect ratio of 0.58) is not available, but the aspect ratio of Times New Roman available is 0.46, then the adjusted font size to be used will be 14 * (0.58 / 0.46) = 17.65px.

initial Sets this property to its default value. See also initial.
inherit Inherits this property from its parent element. See also inherit.

Technical Details

Default value: none
Return value: A string representing the aspect value of the text's font.
CSS Version: CSS3

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Not Supported Not Supported Supported Not Supported Not Supported