overflow-wrap
The overflow-wrap CSS property applies to text, setting whether the browser should insert line breaks within an otherwise unbreakable string to prevent text from overflowing its line box.
Note: The property was originally a nonstandard and unprefixed Microsoft extension called word-wrap, and was implemented by most browsers with the same name. It has since been renamed to overflow-wrap, with word-wrap being an alias.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 23 | 18 | 49 | 7 | 25 | 7 | |
anywhere | 80 | 80 | 65 | 15.4 | 80 | 15.4 |
break-word | 1 | 12 | 3.5 | 1 | 18 | 1 |
normal | 1 | 12 | 3.5 | 1 | 18 | 1 |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Implementation note
- Previously available under a different name: word-wrap (1)
Notes 1 item(s)
Implementation note
- Previously available under a different name: word-wrap (12)
Notes 1 item(s)
Implementation note
- Previously available under a different name: word-wrap (3.5)
Notes 1 item(s)
Implementation note
- Previously available under a different name: word-wrap (1)
Notes 1 item(s)
Implementation note
- Previously available under a different name: word-wrap (18)
Notes 1 item(s)
Implementation note
- Previously available under a different name: word-wrap (1)
Syntax
CSS
.break-word {
overflow-wrap: break-word;
}
/* anywhere ensures line breaks without hyphens when copied */
.anywhere {
overflow-wrap: anywhere;
} Live demo
Use cases
-
Using overflow-wrap
The overflow-wrap CSS property applies to text, setting whether the browser should insert line breaks within an otherwise unbreakable string to prevent text from overflowing its line box.
Cautions
- May not be supported in older browsers.
Accessibility
- Make sure visual changes are conveyed appropriately to assistive technology.