Style wordWrap attribute

Definition and usage

wordWrap The attribute allows long words to be split and wrapped to the next line.

See also:

CSS Reference Manual:word-wrap Property

Example

Allows long words to break and wrap to the next line:

document.getElementById("myDIV").style.wordWrap = "break-word";

Try it yourself

Syntax

Returns the wordWrap property:

object.style.wordWrap

Sets the wordWrap property:

object.style.wordWrap = "normal|break-word|initial|inherit"

Attribute value

Value Description
normal Breaks words only at allowed breakpoints.
break-word Allows breaking of non-breakable words.
initial Sets this property to its default value. See also initial.
inherit Inherits this property from its parent element. See also inherit.

Technical details

Default value: normal
Return value: A string representing the element's word-wrap Property.
CSS Version: CSS3

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support