π What Is word-spacing?
The word-spacing property controls thespace between words in text. It affects how readable and visually balanced text appears β especially in headings, paragraphs, and UI labels.
Note
β Wonβt affect letters inside a word (use letter-spacing)
β Accepts positive, negative, and percentage values
π¦ Syntax
word-spacing syntax
word-spacing: normal | <length> | <percentage>;| Value | Description |
|---|---|
| normal | Default browser spacing |
| <length> | e.g., 5px, 0.5rem, 1em |
| <percentage> | Percentage of the normal spacing |
π 1. Basic Example
Simple usage
p {
word-spacing: 8px;
}Adds 8px extra space between every word.
π 2. Negative Word Spacing
Negative spacing
h1 {
word-spacing: -4px;
}Pulls words closer together β sometimes used for typography in logos and banners.
π 3. Percentage Word Spacing
Percentage spacing
p {
word-spacing: 50%;
}Adds spacing equal to **50% more** than the browser's default word gap.
π 4. Using Word Spacing in Headings
Heading optimization
h2 {
word-spacing: 0.2em;
}Helps balance long headings or titles visually.
π 5. Word Spacing Combined with Letter Spacing
Combined typography
p {
word-spacing: 10px;
letter-spacing: 1px;
}Both spacing types can be used together for professional text styling.
π 6. Using in UI Elements
Button styling
button {
word-spacing: 6px;
text-transform: uppercase;
}Creates a clean, spaced-out UI look for calls-to-action.
π 7. Applying to Specific Words
You cannot directly apply word spacing to a subset of text unless the text is separated into inline elements.
Scoped word spacing
span.word-group {
word-spacing: 20px;
}This spacing applies only to the inline <span> region.
π 8. Using CSS Custom Properties with Word Spacing
Variable spacing
:root {
--space: 0.5rem;
}
p {
word-spacing: var(--space);
}π§ͺ Real-World Examples
1οΈβ£ Magazine-Style Typography
Article typography
article p {
word-spacing: 0.15em;
line-height: 1.7;
}2οΈβ£ Hero Banner Heading
Hero heading
.hero-title {
font-size: 3rem;
word-spacing: 0.3em;
}3οΈβ£ Minimizing Word Spacing for Compact Text
Tight text
.compact {
word-spacing: -2px;
}β οΈ Common Mistakes
- β Using large negative spacing β words may overlap
- β Confusing word-spacing with letter-spacing
- β Overusing spacing can reduce readability
Note
π₯ Summary
The word-spacing property adjusts the spacing *between words*, improving readability or achieving stylistic effects. Use it for paragraphs, headings, UI elements, and hero sections to fine-tune your typography.
Learn more βMDN Docs π