Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style wordWrap property

Style wordWrap property

Style Object Reference The Style object

Example

Allow long words to wrap to the next line:

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

Try it »


Definition and Usage

The wordWrap property allows long words or URL addresses to wrap to the next line.


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the wordWrap property.


Syntax

Return the wordWrap property:

object

.style.wordWrap

Set the wordWrap property:

object

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

Attribute values

Value Description
normal Wraps only at allowed break points (the browser keeps its default behavior).
break-word Wraps inside long words or URL addresses.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical Details

Default value: normal
Return Value: A string, representing the word-wrap property of an element.
CSS version CSS3

Related Articles

CSS Reference Manual:word-wrap property


Style Object Reference The Style object