Style fontSizeAdjust property

Definition and usage

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

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 may 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 typsnitt

CSS Reference Manual:font-size attribute

HTML DOM Reference Manual:font attribute

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. Do not adjust font size.
number

Retain the x-height of the preferred font and calculate the font aspect ratio.

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

Example: If 14px Verdana (aspect ratio of 0.58) is not available, but the aspect ratio of Times New Roman 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 initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: none
Return value: A string representing the text font aspect value.
CSS version: CSS3

Webbläsarstöd

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Stödjer inte Stödjer inte Stödjer Stödjer inte Stödjer inte