Skip to content

Instantly share code, notes, and snippets.

@carlos-sanchez
Created November 14, 2013 00:40
Show Gist options
  • Save carlos-sanchez/7459234 to your computer and use it in GitHub Desktop.
Save carlos-sanchez/7459234 to your computer and use it in GitHub Desktop.
Break long URLs or truncate text. Now we will see two snippets about long strings truncation: one preventing the text to break out of their container (such as an URL) by forcing the break. And one to make an ellipsis in case the string is too long for its container. The first snippet (.break) works in Internet Explorer 8+, Firefox, Safari and Ch…
.break {
-ms-word-break: break-all;
word-break: break-all;
word-break: break-word;
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
}
.ellipsis {
width: 250px;
white-space: nowrap;
overflow: hidden;
-ms-text-overflow: ellipsis; /* Required for IE8 */
-o-text-overflow: ellipsis; /* Required for Opera */
text-overflow: ellipsis;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment