πŸ”€ CSS word-spacing β€” Complete Tutorial

🌐 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.

>>β€œUse word-spacing to improve readability or create stylistic text effects.”

Note

βœ” Applies extra spacing *between words only*
βœ” 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>;
ValueDescription
normalDefault 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

Use word spacing subtly β€” good typography is about balance.

πŸ”₯ 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.

>>β€œSmall spacing choices make a huge difference in visual clarity.”

Learn more β†’MDN Docs πŸ“˜