CSS - word-spacing



The word-spacing property specifies the space between the words in a text.

Possible Values

  • normal: Default value and represents the normal amount of space between words.

  • length: Any specific length {pixels (px), points (pt), ems (em), or percentages (%)}.

  • initial: Sets the word-spacing to its default value.

  • inherit: Allows to inherit the word-spacing value from its parent element.

Applies to

All the HTML elements.

DOM Syntax

object.style.wordSpacing = "10px";

Example

Here is an example:

<html>
<head>
</head>
<body>
   <h2>Word spacing</h2>
   <p style="word-spacing: normal;">Word spacing normal.</p>
   <p style="word-spacing: 15pt;">Word spacing increased.</p>
   <p style="word-spacing: -1px;">Word spacing decreased.</p>
</body>
</html>
Advertisements