Set the space between words in a <p> element to 50 pixels:
The wordSpacing property sets or returns the spacing between words in a text.
Tip: To set or return the spacing between characters in a text, use the letterSpacing property.
The wordSpacing property is supported in all major browsers.
Return the wordSpacing property:
Set the wordSpacing property:
Value | Description |
---|---|
normal | Defines normal spacing between words. This is default |
length | Specifies the space between words in length units. Negative values are allowed |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | normal |
---|---|
Return Value: | A String, representing the space between words in the text |
CSS Version | CSS1 |
Using negative values:
Return the word spacing of a <p> element:
Difference between the letterSpacing property and the wordSpacing property:
CSS tutorial: CSS Text
CSS reference: word-spacing property