Style fontSizeAdjust attribute

Definition and usage

fontSizeAdjust This attribute sets or returns the aspect value of the text 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 available,fontSizeAdjust This attribute 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 attribute.

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

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 attribute:

object.style.fontSizeAdjust

Set fontSizeAdjust attribute:

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 aspect ratio of the font.

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 font 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

Поддержка браузеров

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Не поддерживается Не поддерживается Поддерживается Не поддерживается Не поддерживается