CSS word-spacing attribute
- Previous page word-break
- Next Page word-wrap
Definition
The word-spacing property increases or decreases the spacing between words (i.e., character spacing).
This property defines how many whitespace characters are inserted between elements. For this property, 'word' is defined as a string enclosed by whitespace characters. If specified as a length value, it adjusts the usual spacing between characters; therefore, 'normal' is equivalent to setting it to 0. Negative length values can be specified, which will make the characters closer together.
Note:Negative values can be used.
See also:
CSS Tutorial:CSS Text
HTML DOM Reference Manual:wordSpacing property
Example
Specifies that the character spacing in the paragraph is 25 pixels:
p { word-spacing:25px; }
Tips and notes
Note:CSS defines 'word' as any sequence of non-whitespace characters enclosed by some whitespace character. This definition has no actual semantics; it is merely an assumption that a document contains words enclosed by one or more whitespace characters. User agents that support CSS may not be able to determine which are valid words and which are not in a given language. Although this definition is not very valuable, it means that languages using logographic scripts or non-Roman scripts often cannot specify character spacing.
Tip:Using this property may create documents with excessively wide character spacing, so be cautious when using word-spacing.
CSS syntax
word-spacing: normal|length|initial|inherit;
Property value
Value | Description |
---|---|
normal | Default. Defines the standard space between words. |
length | Defines the fixed space between words. |
inherit | Specifies that the word-spacing property should inherit its value from the parent element. |
Technical details
Default value: | normal |
---|---|
Inheritance: | yes |
Version: | CSS1 |
JavaScript syntax: | object.style.wordSpacing="10px" |
More examples
- Increase or decrease word spacing (character spacing)
- This example demonstrates how to increase the spacing between words in a paragraph.
Browser support
The numbers in the table indicate the first browser version that fully supports this attribute.
Chrome | IE / Edge | Firefox | Safari | Opera |
---|---|---|---|---|
1.0 | 6.0 | 1.0 | 1.0 | 3.5 |
- Previous page word-break
- Next Page word-wrap