Course contentsShow
← Web Development
Lesson 170 of 2,9823. CSS FundamentalsFree lesson

Letter Spacing and Word Spacing

Adjust horizontal spacing between characters and words using letter-spacing and word-spacing.

What You'll Learn

You'll learn how to adjust the horizontal spacing between individual letters and between entire words using CSS properties.

Understanding Letter and Word Spacing

Sometimes the default spacing in text doesn't quite match your design vision. CSS gives you two properties to fine-tune horizontal text spacing:

Letter Spacing controls the space between individual characters. Think of it like adjusting the gaps between tiles on a scrabble board—you can push letters closer together or spread them further apart.

Word Spacing controls the space between whole words. Imagine stretching or compressing the gaps between words in a sentence without affecting the letters within each word.

The CSS Properties

letter-spacing

p {
  letter-spacing: 2px;  /* Adds 2px between each character */
}

h1 {
  letter-spacing: -1px; /* Tightens spacing by 1px */
}

word-spacing

p {
  word-spacing: 10px;   /* Adds 10px between words */
}

blockquote {
  word-spacing: 0.5em;  /* Adds half an em unit */
}

Both properties accept positive values (more space) or negative values (tighter spacing). You can use any length unit: px, em, rem, or even ch.

When to Use These

  • Letter spacing is common for uppercase headings, logos, or creating specific typographic effects
  • Word spacing is less frequently adjusted but useful for justified text or stylized quotes
  • Normal value is normal (the default), which resets to browser defaults

Key Takeaway: Use letter-spacing to adjust character gaps and word-spacing to adjust gaps between words—both properties give you fine-grained control over text readability and visual style.