www.fgks.org   »   [go: up one dir, main page]

Click to Rate and Give Feedback
Properties
 wordWrap Property
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 }
Scripting[ sWrap = ] object.style.wordWrap

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 Cascading Style Sheets (CSS) attribute is inherited.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.

Remarks

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 dependant on the setting of the "text-wrap" property. However, wordWrap settings are always effective in Windows 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: "b" and "londe", or "blo" and "nde", etc.

The following example shows how to use the break-word value 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>
This feature requires Microsoft® Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

This property is defined in Cascading Style Sheets (CSS), Level 3 (CSS3) World Wide Web link.

Applies To

A, ABBR, 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
Tags What's this?: Add a tag
Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker
DCSIMG