{"id":16145,"date":"2012-01-30T20:31:45","date_gmt":"2012-01-31T03:31:45","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=16145"},"modified":"2018-07-25T20:54:37","modified_gmt":"2018-07-26T03:54:37","slug":"prevent-long-urls-from-breaking-out-of-container","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/snippets\/css\/prevent-long-urls-from-breaking-out-of-container\/","title":{"rendered":"Handling Long Words and URLs (Forcing Breaks, Hyphenation, Ellipsis, etc)"},"content":{"rendered":"

There are times when a really long string of text can overflow the container of a layout.<\/p>\n

For example:<\/p>\n

URL’s don’t typically have spaces in them, so they are often culprits.<\/figcaption><\/figure>\n

Here’s a big snippet with all the CSS players involved:<\/p>\n

.dont-break-out {\r\n\r\n  \/* These are technically the same, but use both *\/\r\n  overflow-wrap: break-word;\r\n  word-wrap: break-word;\r\n\r\n  -ms-word-break: break-all;\r\n  \/* This is the dangerous one in WebKit, as it breaks things wherever *\/\r\n  word-break: break-all;\r\n  \/* Instead use this non-standard one: *\/\r\n  word-break: break-word;\r\n\r\n  \/* Adds a hyphen where the word breaks, if supported (No Blink) *\/\r\n  -ms-hyphens: auto;\r\n  -moz-hyphens: auto;\r\n  -webkit-hyphens: auto;\r\n  hyphens: auto;\r\n\r\n}<\/code><\/pre>\n

That would fix the issue for us:<\/p>\n

\"\"<\/figure>\n

Here’s the scoop:<\/p>\n