HTML DOM letterSpacing 屬性
定義和用法
letterSpacing 屬性設(shè)置字符之間的空白。
語法:
Object.style.letterSpacing=normal|length
可能的值
值 | 描述 |
---|---|
normal | 默認(rèn)。定義字符間的標(biāo)準(zhǔn)空間。 |
length | 定義字符間的固定空間。 |
實例
本例改變字符之間的空白:
<html>
<head>
<script type="text/javascript">
function changeLetterSpacing()
{
document.getElementById("p1").style.letterSpacing="3";
document.getElementById("p2").style.letterSpacing="-1";
}
</script>
</head>
<body>
<p id="p1">This is an example paragraph.</p>
<p id="p2">This is another example paragraph.</p>
<input type="button" onclick="changeLetterSpacing()"
value="Change letter-spacing" />
</body>
</html>