Skip to content

Instantly share code, notes, and snippets.

@FFKL
Last active June 1, 2024 18:21
Show Gist options
  • Save FFKL/9018d68ac764d01817221145a6d09a21 to your computer and use it in GitHub Desktop.
Save FFKL/9018d68ac764d01817221145a6d09a21 to your computer and use it in GitHub Desktop.
Auto-resizable ellipsis without fixed width 😮
.ellipsis {
position: relative;
}
.ellipsis:before {
content: ' ';
visibility: hidden;
}
.ellipsis span {
position: absolute;
left: 0;
right: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
<td>
<div class="ellipsis">
<span>Very very long text for this cell</span>
</div>
</td>
@ChrisLuYi-Aon
Copy link

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment