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 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:Fonti ya 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 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 font Times New Roman is available with an aspect ratio of 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: String, that represents the aspect value of the text font.
CSS Version: CSS3

Matumizi ya kifungu

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Hakuna Hakuna Nasi Hakuna Hakuna