HTML DOM Style wordSpacing property
Definition and Usage
wordSpacing property sets or returns the text in the space between words.
grammar
Setting wordSpacing properties:
Object.style.wordSpacing="normal|length|inherit"
Back wordSpacing properties:
Object.style.wordSpacing
值 | 描述 |
---|---|
normal | 默认。定义单词间的标准空间。 |
length | 使用 px、cm 等单位定义单词间的空间。可使用负值。 |
inherit | wordSpacing 属性的值从父元素继承。 |
Browser Support
All major browsers support wordSpacing property.
Note: IE7 and earlier versions do not support the "inherit" value.IE8 only provides! DOCTYPE supported "inherit". IE9 support "inherit".
Examples
Examples
Change the space between words:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.wordSpacing="50px";
}
</script>
</head>
<body>
<p id="p1">这 是 一 些 文 本。</p>
<br>
<button type="button" onclick="displayResult()">修改空间</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.wordSpacing="50px";
}
</script>
</head>
<body>
<p id="p1">这 是 一 些 文 本。</p>
<br>
<button type="button" onclick="displayResult()">修改空间</button>
</body>
</html>
try it"
Style Objects