word-wrap property

Specifies whether to break words when the content exceeds the boundaries of its container.

CSS Text Level 3, Section 7.2

Syntax

word-wrap: normal | break-word

Property values

normal

Default. Content exceeds the boundaries of its container.

break-word

Content wraps to next line, and a word-break occurs when necessary.

CSS information

Applies ToAll elements
Mediavisual
Inherited1
Initial Valuenormal

Standards information

Remarks

Use this property to enable the browser to break up otherwise unbreakable strings.

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 is read-only for the IHTMLCurrentStyle2 interface.

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 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.


p {
   word-wrap: break-word; 
}


<p>
  LongWordLongWord...LongWordLongWord
</p>

See also

CSSStyleDeclaration
currentStyle
runtimeStyle
style
Reference
line-break
word-break
white-space

 

 

Show:
© 2014 Microsoft