Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

word-spacing property

Specifies the amount of additional space between words in the object.

CSS 2.1, Section 5.4.1

Syntax

word-spacing: normal | <length>

Property values

normal

Default. Default spacing.

length

Floating-point followed by an absolute units designator (cm, mm, in, pt, or pc) or a relative units designator (em, ex, or px). For more information about the supported length units, see CSS Values and Units Reference.

CSS information

Applies ToAll elements
Mediavisual
Inherited1
Initial Value

Standards information

Remarks

This attribute adds the specified spacing after each word. Justification can influence word spacing.

The length value indicates an addition to the default space between words. Negative values are permitted.

Examples

The following example shows how to use the word-spacing attribute and the word-spacing property to increase the amount of space between words in a span.


<!DOCTYPE html>

<html>
<head>
  <title>spacing</title>
  <style>
    .spacing {
      word-spacing: 10px;
    }
  </style>
</head>

<body>
  <select id="oSelSpace" onchange="fnChangeSpace()">
    <option>10</option>
   <option>15</option>
   <option>20</option>
  </select>
  <span id="oSpan" class="spacing">The quick brown fox jumped over the lazy dog.
  </span>
  <script>
    function fnChangeSpace() {
      var oSpan = document.getElementById('oSpan');

      oSpan.style.wordSpacing = oSelSpace.options[oSelSpace.selectedIndex].text + "px";
    }
  </script>
</body>
</html>

See also

CSSStyleDeclaration
currentStyle
runtimeStyle
style
CSS Enhancements in Internet Explorer 6

 

 

Show:
© 2014 Microsoft