HTML DOM wordSpacing 屬性
定義和用法
wordSpacing 屬性設(shè)置文本中的單詞間距。
語法:
Object.style.wordSpacing=normal|length
可能的值
值 | 描述 |
---|---|
normal | 默認(rèn)。定義單詞間的標(biāo)準(zhǔn)空間。 |
length | 定義單詞間的固定空間。 |
實(shí)例
本例改變單詞間的間距:
<html>
<head>
<script type="text/javascript">
function changeWordSpacing()
{
document.getElementById("p1").style.wordSpacing="10px";
}
</script>
</head>
<body>
<p id="p1">This is an example paragraph</p>
<input type="button" onclick="changeWordSpacing()"
value="Change space between words" />
</body>
</html>