CSS Reference ยท Typography
The word-spacing property
Reference for the CSS word-spacing property: adding or removing space between words, length values, inheritance, justified text and live examples.
The word-spacing property changes the amount of space the browser draws between words. It adds to (or subtracts from) the normal width of each word separator, such as a regular space. Use it sparingly: a small positive value can open up tight display text, and a negative value can tidy a heading with wide gaps.
CSS
.title { word-spacing: 0.25em; }
Try it
Syntax
CSS
word-spacing: normal | <length>;
- Initial value:
normal - Applies to: all elements; also
::first-letterand::first-line - Inherited: yes
- Animatable: yes, as a length
- Computed value: an absolute length (
normalcomputes to0)
Values
| Value | Description |
|---|---|
normal |
The default word separator width from the font. |
<length> |
Extra space added to each word separator, for example 0.2em or 4px. Negative values pull words closer. |
The CSS specification also allows percentages; check a compatibility table before relying on them.
Usage notes
- What counts as a word separator. Mostly the space character (and similar separators such as the no-break space). Letters inside a word are not affected; use
letter-spacingfor that. - Prefer
em. The gap then scales with the font size. - Justified text.
text-align: justifydistributes extra space between words too.word-spacingshifts the starting width, but the browser still adjusts gaps per line. - Scripts without spaces. Languages such as Chinese or Japanese normally have no spaces between words, so the property has little effect there.
- Don't fake paragraph structure. Spacing words widely to create columns or alignment is fragile. Use real layout tools.
- Accessibility. Overly wide or tight word gaps make text harder to read. Keep changes small for body text.
Browser support
Supported in every browser for length values.
Related
letter-spacingโ spacing between characterstext-alignโ includingjustifywhite-spaceโ how spaces are collapsed- Lesson: Styling Text