wordSpacing 属性设置或返回文本中单词之间的间距。
提示:要设置或返回文本中字符之间的间距,请使用字母间距属性。
Property | |||||
---|---|---|---|---|---|
WordSpacing | Yes | Yes | Yes | Yes | Yes |
返回 wordSpacing 属性:
object.style.wordSpacing
设置 wordSpacing 属性:
object.style.wordSpacing = "normal|
length|initial|inherit"
Value | Description |
---|---|
normal | Defines normal spacing between words. This is default |
length | Specifies the space between words in length units. Negative values are allowed |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
默认值: | 普通的 |
---|---|
返回值: | 一个字符串,表示文本中单词之间的空格 |
CSS版本 | CSS1 |
letterSpacing 属性和 wordSpacing 属性之间的区别:
function changeLetters() {
document.getElementById("myP1").style.letterSpacing = "15px";
}
function changeWords() {
document.getElementById("myP2").style.wordSpacing = "15px";
}
亲自试一试 »
CSS教程:CSS 文本
CSS 参考:字间距属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!