Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Summary

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

初始值normal
适用元素all elements. It also applies to ::first-letter and ::first-line.
是否是继承属性yes
Percentagesrefer 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

How to read CSS syntax.

normal | <length> | <percentage>

Examples

以下 CSS 代码:

#mozdiv1 {
  word-spacing: 15px;
}

#mozdiv2 {
  word-spacing: 5em;
}
 
 
 
 
 
 
 

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

example.png

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 ? ? ? ? ?

文档标签和贡献者

 此页面的贡献者: Sebastianz, luobotang, fscholz, FredWe, teoli, sunorry
 最后编辑者: Sebastianz,