Skip to content

Instantly share code, notes, and snippets.

@jmwhittaker
Last active August 29, 2015 14:07
Show Gist options
  • Save jmwhittaker/5dc0a431b464b0cdf490 to your computer and use it in GitHub Desktop.
Save jmwhittaker/5dc0a431b464b0cdf490 to your computer and use it in GitHub Desktop.
.container {
font-family: helvetica, sans-serif;
padding-right:30px; /* Same padding as the img required */
}
.item {
display: inline-block;
text-align:left;
padding-right:30px; /* Same padding as the img required */
background:url( "http://www.lorempixel.com/30/30") no-repeat center right; /* set img as background & position */
}
/* Or you could use :before for the same effect */
/*
.item:before {
position: absolute;
right: 0;
content:' ';
width:30px;
height:30px;
background-color:red;
}
*/
.ellipsis {
max-width: 100%;
vertical-align: bottom;
overflow: hidden;
white-space: nowrap;
word-wrap: normal;
-ms-text-overflow: ellipsis;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
}
<div class="outer">
<div class="container">
<div class="item ellipsis">A really long long long long long long long long piece of text</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment