首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

字母间距 | letter-spacing

letter-spacing CSS属性指定的文本字符之间的间距行为。

代码语言:javascript
复制
/* <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不同,此值允许用户代理更改字符之间的空格以便对齐文本。

除了字符之间的默认空格之外,还<length>指定了额外的字符间空格。价值观可能是负面的,但是可能存在实施特定的限制。用户代理可能不会进一步增加或减少字符间空间以证明文本的正确性。

形式语法

代码语言:javascript
复制
normal | <length>

实例

HTML

代码语言:javascript
复制
<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

代码语言:javascript
复制
.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

?

?

?

?

?

?

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com