Latest web development tutorials
 

Style wordWrap Property

< Style Object

Example

Allow long words to be able to break and wrap onto the next line:

document.getElementById("myDIV").style.wordWrap = "break-word";
Try it Yourself »

Definition and Usage

The wordWrap property allows long words to be able to be broken and wrap onto the next line.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The wordWrap property is supported in all major browsers.


Syntax

Return the wordWrap property:

object.style.wordWrap

Set the wordWrap property:

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

Property Values

Value Description
normal Break words only at allowed break points
break-word Allows unbreakable words to be broken
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

Technical Details

Default Value: normal
Return Value: A String, representing the word-wrap property of an element
CSS Version CSS3

Related Pages

CSS reference: word-wrap property


< Style Object