word-spacing property

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

CSS 2.1, Section 5.4.1Internet Explorer 9

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

The word-spacing property is available on Macintosh beginning with Microsoft Internet Explorer 4.01. It is available for other platforms beginning with Microsoft Internet Explorer 6.

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.

In Internet Explorer 6, This property now applies to the currentStyle element.

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. All rights reserved.