-ms-word-wrap Attribute | wordWrap Property
Gets or sets whether to break words when the content exceeds the boundaries of its container.
Syntax
CSS { -ms-word-wrap : sWrap } Scripting [ sWrap = ] object.style.wordWrap
Possible Values
sWrap String that specifies or receives one of the following values.
- normal
- Default. Content exceeds the boundaries of its container.
break-word- Content wraps to next line, and a word-break occurs when necessary.
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
Windows Internet Explorer 8. The -ms-word-wrap attribute is an extension to CSS, and can be used as a synonym for word-wrap in IE8 Standards mode.
Use this property to enable the browser to break up otherwise unbreakable strings.
This differs from the whiteSpace property, which turns wrapping of the text on and off. The wordWrap property addresses only whether wrapping is permitted to occur at a place in the word that is not otherwise allowed by the language rules in effect.
The standards referenced below define this property's behavior as being dependent on the setting of the "text-wrap" property. However, wordWrap settings are always effective in Internet Explorer because Internet Explorer does not support the "text-wrap" property.
This property is read-only for the currentStyle object.
This property applies to elements that have layout. An element has layout when it is absolutely positioned, is a block element, or is an inline element with a specified height or width.
Examples
The word "blonde" is not wrappable under typical English rules. But, when wordWrap is set to break-word, the word "blonde" can be split onto two lines in any way the browser chooses: such as "b" and "londe", or "blo" and "nde".
The following example shows how to use the
break-wordvalue of the wordWrap property to break one long word onto multiple lines. This value avoids horizontal scrolling and can be useful for printing. The p element in this example has layout, because its width is set.<P STYLE="word-wrap:break-word;width:100%;left:0"> LongWordLongWord...LongWordLongWord</P>Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/wordWrap.htm
Standards Information
This property is defined in Cascading Style Sheets (CSS), Level 3 (CSS3).
Applies To
A, ABBR, ACRONYM, ADDRESS, APPLET, B, BDO, BIG, BLOCKQUOTE, BODY, BUTTON, CENTER, CITE, CODE, CSSStyleDeclaration, currentStyle, CUSTOM, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, hn, HR, HTML, I, IMG, INPUT, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MENU, NOBR, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, RT, RUBY, runtimeStyle, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, style, SUB, SUP, TD, TEXTAREA, TH, TT, U, UL, VAR, XMP, CSSCurrentStyleDeclaration Constructor, CSSRuleStyleDeclaration Constructor, CSSStyleDeclaration Constructor
See Also
- 1/6/2011
- Marc Stober
For text-only elements this consumes time, eg. pasting a 1MB-text-file, 1 min./PC-GHz.
A tentative remedy for large MB-text, is to use--
1. a contentEditable HTML-area (for text),
2. an onpaste-event surrogate, and,
3. a dummy-wrapper:
eg:
<CITE>
<DIV id=prepTextarea contentEditable
onpaste='var spot=document.selection.createRange();spot.text=clipboardData.getData("text");return false'
style=PADDING:2;WIDTH:384;HEIGHT:40;BORDER:0;FONT-SIZE:16px;COLOR:white;BACKGROUND-COLOR:maroon;OVERFLOW-Y:scroll;WORD-WRAP:BREAK-WORD;OVERFLOW-X:hidden;CURSOR:text; etc.>
<XMP>pretext before using</XMP>
</DIV>
</CITE>
Here the <CITE> dummy-wrapper tells Microsoft to 'play-IBM' and jumper the delay.
Alternative dummy-wrappers include <LISTING> which is fastest and cleanest-looking (compresses internal margin) but deprecated... etc.
STATUS: TENTATIVE
PROBLEMS: onpaste must wait for clipBoard to fill from source (else it pastes the prior value, as happens on large-MB text).
BENEFITS: zowie-fast: 3 sec. instead of 1 min. on MB-text.
- 6/19/2008
- Mr. Raymond Kenneth Petry
- 7/9/2008
- Mr. Raymond Kenneth Petry
