HTML DOM Style fontSizeAdjust property
Definition and Usage
fontSizeAdjust property sets or returns the text font aspect value.
All fonts have theaspect value, the difference in size that is lowercase "x" and uppercase "X" between.
When the first select the font is not available, fontSizeAdjust property gives you more control over the font size. When a font is not available, a second browser using the specified font. This may lead to changes in font size. To prevent this, use the property.
When the browser know that the first choice aspect of the font, the browser can be calculated using the second to select the font to use when displaying text font size.
grammar
Setting fontSizeAdjust properties:
Object.style.fontSizeAdjust="none|value|inherit"
Back fontSizeAdjust properties:
Object.style.fontSizeAdjust
值 | 描述 |
---|---|
none | 默认。不要保留第一选择字体的 x-height。 |
value | 保留第一选择字体的 x-height,并计算字体的 aspect 值比率。 使用的公式:首选字体的字体尺寸 * (第一选择字体的 aspect 值 / 可用字体的 aspect 值) = 可用字体的字体尺寸 实例:如果 14px 的 Verdana(aspect 值是 0.58)不可用,但是某个可用的字体(Times New Roman)的 aspect 值是 0.46,那么替代字体的尺寸将是 14*(0.58/0.46) = 17.65px。 |
inherit | fontSizeAdjust 属性的值从父元素继承。 |
Browser Support
Only Firefox supports fontSizeAdjust property.
Examples
Examples
Adjust font size:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
document.getElementById ( "p1") style.fontSizeAdjust = "0.58".;
}
</ Script>
</ Head>
<Body>
<P id = "p1"> This is some text </ p>
<br>
<Button type = "button" onclick = "displayResult ()"> Adjust font size </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
document.getElementById ( "p1") style.fontSizeAdjust = "0.58".;
}
</ Script>
</ Head>
<Body>
<P id = "p1"> This is some text </ p>
<br>
<Button type = "button" onclick = "displayResult ()"> Adjust font size </ button>
</ Body>
</ Html>
try it"
Style Objects