HTML DOM fontStretch 屬性

定義和用法

fontStretch 屬性用于對當前的 font-family 進行伸縮變形。

語法:

Object.style.fontStretch=value

可能的值

描述
normal 默認值。把縮放比例設置為標準。
wider 把伸展比例設置為更進一步的伸展值
narrower 把收縮比例設置為更進一步的收縮值
  • ultra-condensed
  • extra-condensed
  • condensed
  • semi-condensed
  • semi-expanded
  • expanded
  • extra-expanded
  • ultra-expanded

設置 font-family 的縮放比例。

"ultra-condensed" 是最寬的值,而 "ultra-expanded" 是最窄的值。

實例

本例對字體進行伸展:

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