CSS word-break attribute

Definition and usage

The word-break property specifies the handling of automatic line breaks.

Tip:By using the word-break property, browsers can implement line breaks at any position.

Example

Line breaks at appropriate hyphenation points:

p.test {word-break:hyphenate;}

Try it yourself

CSS syntax

word-break: normal|break-all|keep-all;

Attribute value

Value Description
normal Use the browser's default line break rules.
break-all Line breaks are allowed within words.
keep-all Line breaks are only allowed at half-width spaces or hyphens.

Technical details

Default value: normal
Inheritance: yes
Version: CSS3
JavaScript syntax: object.style.wordBreak="keep-all"

Browser support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome IE / Edge Firefox Safari Opera
4.0 5.5 15.0 3.1 15.0