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

CSS Reference Manual

CSS @rules (RULES)

Complete List of CSS Attributes

CSS word-Usage and examples of spacing attribute

word-The spacing CSS attribute sets the word spacing of the text content, increasing or decreasing the spacing between words.

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

Default value:normal
Applies to:All elements. It also applies to:: first-line.
Inheritance:Yes
Can be animated:Yes.Please refer to Animation properties.
Version:CSS 1,2,3
JavaScript syntax:object.style.wordSpacing="20px"

word-The syntax of spacing usage

The syntax of this attribute is as follows:

word-spacing: length | normal | initial | inherit

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

  p {
   word-spacing: 50px;
  }
Test and see‹/›

Attribute value

The following table describes the value of this attribute.

ValueDescription
lengthSpecify the additional spacing between words, with length values such as px, pt, cm, em, etc. Negative length values are allowed.
normalSpecify the spacing between words based on the current font and/or the normal word spacing defined by the browser. This is the default value.
initialSet this attribute to its default value.
inheritIf specified, the associated element adopts the word spacing of its parent element.-The value of the spacing attribute.

Browser compatibility

word-Browser compatibility of the spacing attribute, the numbers in the table below represent the minimum version number of browsers that support this attribute; all mainstream browsers support this attribute.

  • Firefox 1+

  • Google Chrome1+

  • Internet Explorer 4+

  • Apple Safari 1+

  • Opera 4+

For further reading

Please refer to the following tutorials:HTML text formatting.

Related attributes:letter-spacing,white-space.