Skip to content

Instantly share code, notes, and snippets.

@mttmzr
mttmzr / is-truncated.js
Last active February 1, 2022 05:23
Simple javascript function to check if an element is truncated.
/**
* Check if an element is truncated.
*
* CSS to be used:
* .truncate {
* width: 250px;
* white-space: nowrap;
* overflow: hidden;
* text-overflow: ellipsis;
* }