Handling Long Words and URLs (Forcing Breaks, Hyphenation, Ellipsis, etc)

All from css-tricks:

There are times when a really long string of text can overflow the container of a layout.

For example:

URL’s don’t typically have spaces in them, so they are often culprits.
Here’s a big snippet with all the CSS players involved:

.dont-break-out {

/* These are technically the same, but use both */
overflow-wrap: break-word;
word-wrap: break-word;

-ms-word-break: break-all;
/* This is the dangerous one in WebKit, as it breaks things wherever */
word-break: break-all;
/* Instead use this non-standard one: */
word-break: break-word;

/* Adds a hyphen where the word breaks, if supported (No Blink) */
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;

}

https://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/

It's only fair to share...Tweet about this on Twitter
Twitter
Share on Facebook
Facebook
Email this to someone
email
Share on Google+
Google+
This entry was posted in HTML/CSS, Web Dev. Bookmark the permalink.