word-spacing

Summary

属性 word-spacing 用于声明标签和单词直接的间距行为。

初始值normal
适用元素all elements. It also applies to ::first-letter and ::first-line.
是否是继承属性yes
Percentagesrefer to the width of the affected glyph
计算值an optimum, minimum, and maximum value, each consisting of either an absolute length, a percentage, or the keyword normal
Animation typea length

Syntax

word-spacing: normal;    /* Keyword value */
word-spacing: 3px;       /* <length> values */
word-spacing: 0.3em;

word-spacing: inherit;
 
 
 
 
 

Values

normal
正常的单词间距,由当前字体和/或浏览器定义。
<length>
通过指定具体的额外间距来增加字体的单词间距。查看 <length> 了解可用单位。
<percentage>
通过指定受影响字符的宽度的百分比的方式来增加的间距。

Formal syntax

Examples

以下 CSS 代码:

#mozdiv1 {
  word-spacing: 15px;
}

#mozdiv2 {
  word-spacing: 5em;
}
 
 
 
 
 
 
 

会为两个包含如下内容 <div> 标签添加如下样式:

example.png

Specifications

Specification Status Comment
CSS Text Module Level 3
word-spacing
Candidate Recommendation Replace the previous values with a<spacing-limit> value that defines the same value, plus the<percentage> value and allows up to three values describing the optimum, minimum, and maximum value.
CSS Transitions
word-spacing
Working Draft Defines word-spacing as animatable.
CSS Level 2 (Revision 1)
word-spacing
Recommendation No change.
CSS Level 1
word-spacing
Recommendation Initial specification.

Browser compatibility

BCD tables only load in the browser