word-wrap
Example
.comment {
word-wrap: break-word;
}.comment {
overflow-wrap: break-word;
}word-wrap is a legacy alias; overflow-wrap is the standard name with the same 'break-word' behavior.
Common mistakes
- Copying
word-wrap: break-wordfrom old snippets instead of the standard name.
Key points
- New code uses
overflow-wrap, withword-wraponly as an extra legacy line if at all. - Long words are broken with 'break-word' or 'anywhere', not with
word-break: break-all.
Interview questions
Does word-wrap still work?
Yes. Browsers keep word-wrap as an alias of overflow-wrap for compatibility, but it is not the standard name.
Does word-wrap support the anywhere value?
As an alias it accepts the same values as overflow-wrap, but use overflow-wrap: anywhere to be clear.