English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS reference manual

CSS @rules

CSS attributes大全

CSS letter-Usage and examples of the spacing attribute

letter-The spacing CSS attribute sets the additional spacing between letters of the element text.

The following table provides usage instructions and version history of this attribute, as well as the syntax of its use in JavaScript scripts.

Default value:normal
Applies to:all elements. It also applies to:: first-letterand:: first-line.
Inheritance:Yes
Can be animated:Yes.Please refer to Animation attribute.
Version:CSS 1,2,3
JavaScript syntax:object.style.letterSpacing="5px"

letter-The syntax of spacing

The syntax of this attribute is as follows:

letter-spacing: length | normal | initial | inherit

The following examples demonstrate how to use letter-spacing attribute.

  h1 {
   letter-spacing: -3px;
  }
  p {
   letter-spacing: 15px;
  }
Test and see‹/›

Note:for letter-The spacing attribute, the normal value is not equal to the length value 0. If the value is the normal value, the space can be adjusted by the browser to align the text; if the value is 0, it cannot.

Attribute value

The following table describes the value of this attribute.

ValueDescription
normalSpacing is the normal spacing of the current font. This space can be adjusted by the browser to align text. This is the default value.
lengthThe length value specifies the additional spacing inserted between characters other than the default character spacing. Browsers may not be able to adjust this space to align text.
initialSet this attribute to its default value.
inheritIf specified, the associated element adopts the letter spacing of its parent element letter-The value of the spacing attribute.

Browser compatibility

etter-The compatibility of the spacing attribute across browsers, the numbers in the table below represent the minimum version number of the browser that supports this attribute; all mainstream browsers support this attribute.

  • Firefox 1+

  • Google Chrome1+

  • Internet Explorer 4+

  • Apple Safari 1+

  • Opera 3.5+

Further reading

Please refer to the following tutorials:CSS Text.

Related attributes:white-space,word-spacing.