overflow-wrap
The overflow-wrap CSS property breaks a line of text onto multiple lines inside the targeted element in an otherwise unbreakable place to prevent overflow. The legacy property is word-wrap.
Overview
The overflow-wrap CSS property breaks a line of text onto multiple lines inside the targeted element in an otherwise unbreakable place to prevent overflow. The legacy property is word-wrap.
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 breaks a line of text onto multiple lines inside the targeted element in an otherwise unbreakable place to prevent overflow. The legacy property is word-wrap.
Cautions
- May not be supported in older browsers.
Accessibility
- Make sure visual changes are conveyed appropriately to assistive technology.
Related links
Powered by web-features