Style fontSizeAdjust Property

Definition and Usage

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

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

When the preferred font is not available,fontSizeAdjust This property allows you to better control 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 skrifttype

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'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 0.58) is not available, but Times New Roman with an aspect ratio of 0.46 is available, 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 that represents the aspect value of the text font.
CSS version: CSS3

Browser understøttelse

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Ikke understøttet Ikke understøttet Understøttet Ikke understøttet Ikke understøttet