Created
November 14, 2013 00:40
-
-
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…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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