CSS Property word-spacing








word-spacing defines the amount of whitespace between words in an element.

Summary

ItemValue
Initial value normal
Inherited Yes
Version CSS1
JavaScript syntax object.style.wordSpacing="5px"
Applies to All elements.




CSS Syntax

 word-spacing: length  | normal | inherit

Property Values

The property values are listed in the following table.

ValueDescription
normal Default value. Use normal space between words.
length space in px, pt, cm, em, etc. Negative values are allowed
inherit Inherit the word-spacing property from the parent element

Browser compatibility

word-spacing Yes Yes Yes Yes Yes




Example

An example showing how to use word-spacing CSS property.

<!DOCTYPE HTML>
<html>
    <head>
        <style>
      p {<!--from w w  w  . ja v a 2  s  .  c  o  m-->
          word-spacing: -5px;
      }
        </style>
    </head>
    <body>
    <p>
        a negative value.
    </p>
    </body>
</html>

Click to view the demo