{"id":17958,"date":"2012-09-04T15:13:24","date_gmt":"2012-09-04T22:13:24","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=17958"},"modified":"2021-07-12T14:38:44","modified_gmt":"2021-07-12T21:38:44","slug":"word-break","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/w\/word-break\/","title":{"rendered":"word-break"},"content":{"rendered":"

The word-break<\/code> property in CSS can be used to change when line breaks ought to occur. Normally, line breaks in text can only occur in certain spaces, like when there is a space or a hyphen.<\/p>\n

<\/p>\n

In the example below we can make the word-break<\/code> between letters instead:<\/p>\n

.element {\n  word-break: break-all;\n}<\/code><\/pre>\n

If we then set the width of the text to one em<\/code>, the word will break by each letter:<\/p>\n

See the Pen Setting text vertically with word-break<\/a> by CSS-Tricks (@css-tricks<\/a>) on CodePen<\/a>.<\/p>\n

This value is often used in places with user generated content so that long strings don’t risk breaking the layout. One very common example is a long copy and pasted URL. If that URL has no hyphens, it can extend beyond the parent box and look bad or worse, cause layout problems.<\/p>\n

See the Pen Fixing links with word-break<\/a> by CSS-Tricks (@css-tricks<\/a>) on CodePen<\/a>.<\/p>\n

Values<\/h3>\n