HTML DOM wordSpacing 属性

定义和用法

wordSpacing 属性设置文本中的单词间距。

语法:

  1. Object.style.wordSpacing=normal|length

可能的值

描述
normal 默认。定义单词间的标准空间。
length 定义单词间的固定空间。

实例

本例改变单词间的间距:

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function changeWordSpacing()
  5. {
  6. document.getElementById("p1").style.wordSpacing="10px";
  7. }
  8. </script>
  9. </head>
  10. <body>
  11.  
  12. <p id="p1">This is an example paragraph</p>
  13.  
  14. <input type="button" onclick="changeWordSpacing()"
  15. value="Change space between words" />
  16.  
  17. </body>
  18. </html>