HTML DOM wordSpacing 属性
定义和用法
wordSpacing 属性设置文本中的单词间距。
语法:
- Object.style.wordSpacing=normal|length
可能的值
值 | 描述 |
---|---|
normal | 默认。定义单词间的标准空间。 |
length | 定义单词间的固定空间。 |
实例
本例改变单词间的间距:
- <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>