word-wrap

Important

This documentation is preliminary and subject to change.

Sets the mode of text wrapping.

Syntax

{ word-wrap: sWrap }

Possible values

sWrap

String that specifies 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.

This property has a default value of normal. It is inherited.

Remarks

This differs from the white-space property, which turns wrapping of the text on and off. The word-wrap 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.

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" cannot be wrapped under typical English rules. But, when word-wrap 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-word value of the word-wrap 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>

Standards information

This property is defined in CSS Selectors Level 3 Gg721773.xtlink_newWindow(en-us,Expression.40).png.

Applies to

a, address, b, big, blockquote, body, button, caption, center, cite, code, col, colgroup, custom, dd, defaults, dfn, 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, li, ol, p, s, span, sub, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var, xmp

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.