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

HTML DOM Style wordBreak property

Style wordBreak property

Style Object Reference The Style object

Example

Break a line between any two letters:

document.getElementById("myDIV").style.wordBreak="break-all";

Try it »


Definition and Usage

The wordBreak property specifies the line-breaking rules for non-CJK languages.

**Tip:** CJK refers to Chinese, Japanese and Korean.


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the wordBreak property.


Syntax

Return the wordBreak property:

object

.style.wordBreak

Set the wordBreak property:

object

.style.wordBreak="normal|break-all|keep-all|initial|inherit"

Attribute values

Value Description
normal Default. Uses the browser's default line-breaking rules.
break-all Allows a break between any two letters inside a word.
keep-all  Allows a break only at half-width spaces or hyphens.
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-break property of an element.
CSS version CSS3

Related Articles

CSS Reference Manual:word-break property


Style Object Reference The Style object