Javascript DOM CSS Style fontSizeAdjust Property

Introduction

Adjust font size:

document.getElementById("myP").style.fontSizeAdjust = "0.58";

View in separate window

<!DOCTYPE html>
<html>
<body>

<p id="myP">This is a paragraph.</p>

<button type="button" onclick="myFunction()">Adjust font size</button>
<script>
function myFunction() {/*ww  w .  ja  v  a2s .  c o m*/
  document.getElementById("myP").style.fontSizeAdjust = "0.58";
}
</script>
</body>
</html>

The fontSizeAdjust property sets or gets the font aspect value of a text.

The fontSizeAdjust property is only supported in Firefox.

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

Value
Description
none
Default value. No font size adjustment
number


Preserve the first-choice font's x-height, and calculate the aspect value ratio for the font.
The formula that is used:
font-size of first-choice font*(aspect value of first-choice font/aspect value of available font)=font-size to use on available font
initial
Sets this property to its default value.
inherit
Inherits this property from its parent element.

The fontSizeAdjust property default Value: none

The fontSizeAdjust property returns a String representing the font aspect value of a text.




PreviousNext

Related