This page is Ready to Use

Notice: The WebPlatform project has been discontinued when the Stewards partnership agreement ended in September 2015. This site has been frozen, and the assets we have created will remain.

word-spacing

Summary

The word-spacing CSS property specifies the spacing behavior between "words".

Overview table

Initial value
normal
Applies to
All elements
Inherited
Yes
Media
visual
Computed value
an optimum, minimum, and maximum value, each consisting of either an absolute length, a percentage, or the keyword ‘normal’
Animatable
No
CSS Object Model Property
wordSpacing
Percentages
refers to width of the affected glyph

Syntax

  • word-spacing: length
  • word-spacing: normal
  • word-spacing: percentage

Values

normal
The spacing is the normal spacing for the current font.
length
Indicates inter-word space in addition to the default space between words, followed by an absolute units designator (cm, mm, in, pt, or pc) or a relative units designator (em, ex, or px). Values may be negative, but there may be implementation-specific limits.
percentage
Specifies the additional spacing as a percentage of the affected word’s advance measure.

Examples

The following example shows how to use the word-spacing attribute and the word-spacing property to increase the amount of space between words in a p element.

<p>This is a simple paragraph with the default value for word-spacing.</p>

<p class="pos">This is a simple paragraph with a altered word-spacing value by 0.3em.</p>

<p class="neg">This is a simple paragraph withe a altered word-spacing value by -0.1em</p>

View live example

p {
    word-spacing: normal;
}

p.pos {
    word-spacing: .3em;
}

p.neg {
    word-spacing: -.1em;
}

Usage

 * Up to three different values can be specified, in the following order: optimum, minimum, maximum
  • If one value is specified, it is used for all spacing. If two values are specified, the first is used for the optimum and minimum spacings, and the second is used for maximum.

Notes

When specified as a positive length value, the word-spacing attribute adds the specified value to the default spacing between words within an element. A negative length value decreases the space between words. Word spacing can be influenced by justification.

Related specifications

CSS Text Module Level 3
W3C Working Draft

See also

Other articles

Attributions