{"id":250100,"date":"2017-01-17T17:17:53","date_gmt":"2017-01-18T00:17:53","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=250100"},"modified":"2022-09-28T10:16:55","modified_gmt":"2022-09-28T17:16:55","slug":"overflow-wrap","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/o\/overflow-wrap\/","title":{"rendered":"overflow-wrap"},"content":{"rendered":"\n

The overflow-wrap<\/code> property in CSS allows you to specify that the browser can break a line of text inside the targeted element onto multiple lines in an otherwise unbreakable place. This helps to avoid an unusually long string of text causing layout problems due to overflow.<\/p>\n\n\n\n\n\n\n\n

.example {\n  overflow-wrap: break-word;\n}<\/code><\/pre>\n\n\n

Syntax<\/h3>\n\n\n
overflow-wrap = \n  normal      |\n  break-word  |\n  anywhere    <\/code><\/pre>\n\n\n\n
  • Initial value:<\/strong> normal<\/code><\/li>
  • Applies to:<\/strong> non-replaced inline elements<\/li>
  • Inherited:<\/strong> yes<\/li>
  • Computed value:<\/strong> as specified<\/li>
  • Animation type:<\/strong> discrete<\/li><\/ul>\n\n\n

    Values<\/h3>\n\n\n
    • normal<\/code>:<\/strong> the default. The browser will break lines according to normal line breaking rules. Words or unbroken strings will not break, even if they overflow the container.<\/li>
    • break-word<\/code>:<\/strong> words or strings of characters that are too large to fit inside their container will break in an arbitrary place to force a line break. A hyphen character will not be inserted, even if the hyphens<\/code> property is used.<\/li>
    • inherit<\/code>:<\/strong> the targeted element must inherit the value of the overflow-wrap<\/code> property defined on its immediate parent.<\/li><\/ul>\n\n\n\n

      The demo below has a toggle button that allows you to switch between normal<\/code> and break-word<\/code>.<\/p>\n\n\n\n