CSS word-spacing
property is used to change the gap between the words of a text.
A positive value increases the gap while a negative value decreases the gap between the words. It can be specified in any valid CSS length format such as px, em, rem, cm, etc.
Try out the example below to see how it works:
Example:
.p1{ word-spacing: normal; } .p2{ word-spacing: 10px; } .p3{ word-spacing: 20px; } .p4{ word-spacing: -1px; }
CSS Syntax
The word-spacing
property has the below syntax:
word-spacing: normal|length|initial|inherit;
Property Values
The word-spacing
property accepts the following values:
normal | Sets a normal spacing between the words. This is the default value. |
length | Sets space between words in a CSS length format such as px, em, rem, cm, etc. Negative values are also allowed. |
initial | Sets the word-spacing property to its default value(normal). |
inherit | Inherits the word-spacing property from its parent element. |
General Info
Default Value | normal |
Inherited | Yes |
JavaScript Usage | element.style.wordSpacing = “20px” |