Latest web development tutorials

HTML DOM Style wordBreak property

Style Object Reference Style Objects

Examples

Between any two letters line breaks:

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

try it"

Definition and Usage

wordBreak attribute specifies the non-line-breaking rules CJK languages.

Tip: CJK language is Chinese (Chinese), Japanese (Japanese) and Korean (Korean).


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support wordBreak property.


grammar

Back wordBreak properties:

object .style.wordBreak

Setting wordBreak properties:

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

Property Value

描述
normal 默认值。使用浏览器默认的换行规则。
break-all 允许在单词内任意两个字母间换行。
keep-all  只能在半角空格或连字符处换行。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

technical details

Defaults: normal
return value: String representing the word-break element attributes.
CSS version CSS3


related articles

CSS Reference Manual: Word-BREAK property


Style Object Reference Style Objects