word-spacing Attribute | wordSpacing Property
Gets or sets the amount of additional space between words in the object.
Syntax
CSS { word-spacing : sSpacing } Scripting [ sSpacing = ] object.style.wordSpacing [ = sSpacing ]
Possible Values
sSpacing String that specifies or receives one of the following values.
- normal
- Default. Default spacing.
- length
- Floating-point followed by an absolute units designator (
cm,mm,in,pt, orpc) or a relative units designator (em,ex, orpx). For more information about the supported length units, see CSS Length Units Reference.The property is read/write for all objects except the following, for which it is read-only: currentStyle. The property has a default value of normal. The Cascading Style Sheets (CSS) attribute is inherited.
DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are supported in IE7 Standards mode and IE5 (Quirks) mode only. For more information, see About Dynamic Properties and Defining Document Compatibility.
Remarks
The wordSpacing property is available on Macintosh beginning with Microsoft Internet Explorer 4.01. It is available for other platforms beginning with 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.
Example
The following example shows how to use the word-spacing attribute and the wordSpacing property to increase the amount of space between words in a span.
<STYLE> SPAN.spacing{word-spacing: 10;} </STYLE> <SCRIPT> function fnChangeSpace(){ oSpan.style.wordSpacing = oSelSpace.options[oSelSpace.selectedIndex].text; } </SCRIPT> <SELECT ID = "oSelSpace" onchange = "fnChangeSpace()"> <OPTION>10 <OPTION>15 <OPTION>20 </SELECT> <SPAN ID = "oSpan" CLASS = "spacing"> The quick brown fox jumped over the lazy dog. </SPAN>
Standards Information
This property is defined in Cascading Style Sheets (CSS), Level 1 (CSS1).
Applies To
A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, CSSStyleDeclaration, currentStyle, CUSTOM, DD, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FORM, hn, HTML, I, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, runtimeStyle, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, style, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP, CSSCurrentStyleDeclaration Constructor, CSSRuleStyleDeclaration Constructor, CSSStyleDeclaration Constructor
See Also
CSS Enhancements in Internet Explorer 6