All Tech Tips

word-wrap Attribute | wordWrap Property

Sets or retrieves whether to break words when the content exceeds the boundaries of its container.

Syntax

HTML { word-wrap : sWrap }
Scriptingobject.style.wordWrap [ = sWrap ]

Possible Values

sWrapString that specifies or receives one of the following values.
normalDefault. Content exceeds the boundaries of its container.
break-wordContent 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 Microsoft Cascading Style Sheets (CSS) extension is inherited.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. .

Remarks

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.

Example

The following example shows how to use the break-word value of the wordWrap property to break one long word into multiple words on 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>

Standards Information

This property is a Microsoft extension to Cascading Style Sheets (CSS) .

Applies To

A, ACRONYM, ADDRESS, APPLET, B, BDO, BIG, BLOCKQUOTE, BODY, BUTTON, CENTER, CITE, CODE, 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, TEXTAREA, TD, TH, TT, U, UL, VAR, XMP

See Also

lineBreak, wordBreak, whiteSpace


Copyright © 2006 alltechtips.com. All rights reserved.

This website and the materials and information you find on this website are provided "as is", without warranty of any kind, either express or implied, including without limitation any warranty for information, services, or products provided through or in connection with the service and any implied warranties of merchantability, fitness for a particular purpose, expectation of privacy or non-infringement.