Thuộc tính fontStretch của HTML DOM

Định nghĩa và cách sử dụng

Thuộc tính fontStretch được sử dụng để co giãn và biến dạng font-family hiện tại.

Cú pháp:

Object.style.fontStretch=value

giá trị có thể

giá trị mô tả
normal Giá trị mặc định. Đặt tỷ lệ phóng to thành tiêu chuẩn.
wider Đặt tỷ lệ co giãn thành giá trị co giãn thêm.
narrower Đặt tỷ lệ co giãn thành giá trị co giãn thêm.
  • ultra-condensed
  • extra-condensed
  • condensed
  • semi-condensed
  • semi-expanded
  • expanded
  • extra-expanded
  • ultra-expanded

Đặt tỷ lệ phóng to của font-family.

"ultra-condensed" là giá trị rộng nhất, còn "ultra-expanded" là giá trị hẹp nhất.

Ví dụ

Ví dụ này co giãn 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="Co giãn font" />
</body>
</html>