HTML DOM fontStretch 属性

定义和用法

fontStretch 属性用于对当前的 font-family 进行伸缩变形。

语法:

Object.style.fontStretch=value

可能的值

描述
normal Default value. Set the scaling ratio to standard.
wider Set the expansion ratio to an even more expandable value
narrower Set the shrinkage ratio to an even more shrinkable value
  • ultra-condensed
  • extra-condensed
  • condensed
  • semi-condensed
  • semi-expanded
  • expanded
  • extra-expanded
  • ultra-expanded

Set the scaling ratio of font-family.

"ultra-condensed" is the widest value, while "ultra-expanded" is the narrowest value.

Example

This example stretches the font:

<html>
<head>
<script type="text/javascript">
function setFontStretch()
{
document.getElementById("p1").style.fontStretch="ultra-expanded";
}
</script>
</head>
<body>
<p id="p1">This is an example paragraph.</p>
<input type="button" onclick="setFontStretch()" 
value="Stretch font" />
</body>
</html>