HTML DOM letterSpacing 属性

定义和用法

letterSpacing 属性设置字符之间的空白。

语法:

Object.style.letterSpacing=normal|length

可能的值

描述
normal 默认。定义字符间的标准空间。
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>