letter-spacing
CSS
property sets the horizontal spacing behavior between text characters. This value is added to the natural spacing between characters while rendering the text. Positive values of
letter-spacing
causes characters to spread farther apart, while negative values of
letter-spacing
bring characters closer together.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
/* Keyword value */ letter-spacing: normal; /* <length> values */ letter-spacing: 0.3em; letter-spacing: 3px; letter-spacing: .3px; /* Global values */ letter-spacing: inherit; letter-spacing: initial; letter-spacing: unset;
normal
0
, this keyword allows the
用户代理
to alter the space between characters in order to justify text.
<length>
A large positive or negative
letter-spacing
value will make the word(s) the styling is applied to unreadable. For text styled with a very large positive value, the letters will be so far apart that the word(s) will appear like a series of individual, unconnected letters. For text styled with a very large negative value, the letters will overlap each other to the point where the word(s) may be unrecognizable.
Legible letter-spacing must be determined on a case-by-case basis, as different font families have different character widths. There is no one value that can ensure all font families automatically maintain their legibility.
| 初始值 |
normal
|
|---|---|
| 适用于 |
所有元素。它还适用于
::first-letter
and
::first-line
.
|
| 继承 | yes |
| 计算值 |
an optimum value consisting of either an absolute length or the keyword
normal
|
| 动画类型 | a length |
normal | <length>
<p class="normal">letter spacing</p> <p class="em-wide">letter spacing</p> <p class="em-wider">letter spacing</p> <p class="em-tight">letter spacing</p> <p class="px-wide">letter spacing</p>
.normal { letter-spacing: normal; }
.em-wide { letter-spacing: 0.4em; }
.em-wider { letter-spacing: 1em; }
.em-tight { letter-spacing: -0.05em; }
.px-wide { letter-spacing: 6px; }
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
letter-spacing
|
Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 4 | Opera 完整支持 3.5 | Safari 完整支持 1 | WebView Android 完整支持 ≤37 | Chrome Android 完整支持 18 | Firefox Android 完整支持 4 | Opera Android 完整支持 10.1 | Safari iOS 完整支持 1 | Samsung Internet Android 完整支持 1.0 |
| SVG support | Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 72 | IE 完整支持 9 | Opera 完整支持 7 | Safari 完整支持 5.1 | WebView Android 完整支持 ≤37 | Chrome Android 完整支持 18 | Firefox Android 不支持 No | Opera Android 完整支持 10.1 | Safari iOS 完整支持 5.1 | Samsung Internet Android 完整支持 1.0 |
完整支持
不支持