DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Chara has posted 50 posts at DZone. View Full User Profile

Prevent Long URL's From Breaking Out with CSS

01.28.2014
| 1541 views |
  • submit to reddit
<style type="text/css">
.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;
}
</style>

This solution will help you to prevent many issues with your site, when you need to prevent long URL's from breaking out of container .