字母间距 | letter-spacing
字母间距
该letter-spacing
CSS属性指定的文本字符之间的间距行为。
/* <length> values */
letter-spacing: 0.3em;
letter-spacing: 3px;
letter-spacing: .3px;
/* Keyword values */
letter-spacing: normal;
/* Global values */
letter-spacing: inherit;
letter-spacing: initial;
letter-spacing: unset;
初始值 | normal |
---|---|
适用于 | 所有元素。它也适用于:: first-letter和:: first-line。 |
遗传 | 是 |
媒体 | visual |
计算值 | 由绝对长度或关键字法线组成的最佳值 |
动画类型 | 长度 |
规范的顺序 | 形式语法定义的独特的非模糊顺序 |
语法
值
normal
当前字体的正常字母间距。与值0不同,此值允许用户代理更改字符之间的空格以便对齐文本。
形式语法
normal | <length>
实例
HTML
<p class="first-example"> letter spacing </p>
<p class="second-example"> letter spacing </p>
<p class="third-example"> letter spacing </p>
<p class="fourth-example"> letter spacing </p>
CSS
.first-example { letter-spacing: 0.4em; }
.second-example { letter-spacing: 1em; }
.third-example { letter-spacing: -0.05em; }
.fourth-example { letter-spacing: 6px; }
规范
Specification | Status | Comment |
---|---|---|
CSS Text Module Level 3The definition of 'letter-spacing' in that specification. | Working Draft | No change. |
CSS TransitionsThe definition of 'letter-spacing' in that specification. | Working Draft | Defines letter-spacing as animatable. |
CSS Level 2 (Revision 1)The definition of 'letter-spacing' in that specification. | Recommendation | No change. |
Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'letter-spacing' in that specification. | Recommendation | Initial SVG definition. |
CSS Level 1The definition of 'letter-spacing' in that specification. | Recommendation | Initial definition. |
浏览器兼容性
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
HTML support | 1.0 | (Yes) | 1.0 (1.7 or earlier) | 4.0 | 3.5 | 1.0 (85) |
SVG support | (Yes) | ? | No support (bug 371787) | ? | (Yes) | (Yes) |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
HTML support | ? | (Yes) | ? | ? | ? | ? |
SVG support | ? | ? | ? | ? | ? | ? |