Force line break in a long word using CSS
Question:
How to force line break in a long word using CSS? Answer:
overflow-wrap: break-word;
Description:
To force a line break in case of a long word or any long text without spaces use the overflow-wrap
property and set it to break-word
.
The overflow-wrap
CSS property applies to inline elements, setting whether the browser should insert line breaks within an otherwise unbreakable string to prevent text from overflowing its line box.
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.
Reference:
CSS overflow-wrap reference
Share "How to force line break in a long word using CSS?"
Related snippets:
Tags:
force line break, broke text within words, line break, long word, text without space, wrap, break-word Technical term:
Force line break in a long word using CSS