Summary
属性
word-spacing
用于声明标签和单词直接的间距行为。
初始值 | normal |
---|---|
适用元素 | all elements. It also applies to ::first-letter and ::first-line . |
是否是继承属性 | yes |
Percentages | refer to the width of the affected glyph |
适用媒体 | visual |
计算值 | an optimum, minimum, and maximum value, each consisting of either an absolute length, a percentage, or the keyword normal |
是否适用于 CSS 动画 | yes, as a length |
正规顺序 | the unique non-ambiguous order defined by the formal grammar |
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
normal | <length> | <percentage>
Examples
以下 CSS 代码:
#mozdiv1 {
word-spacing: 15px;
}
#mozdiv2 {
word-spacing: 5em;
}
会为两个包含如下内容 <div>
标签添加如下样式:
Specifications
Specification | Status | Comment |
---|---|---|
CSS Text Level 3 word-spacing |
Working Draft | 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
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 1.0 | 1.0 (1.7 or earlier) | 6.0 | 3.5 | 1.0 (85) |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | ? | ? | ? | ? | ? |