Responsive Multi-line Text Truncating In Pure JavaScript – Ellipsis.js

Category: Javascript , Recommended , Text | August 11, 2026
Authorglinford
Last UpdateAugust 11, 2026
LicenseMIT
Views9,122 views
Responsive Multi-line Text Truncating In Pure JavaScript – Ellipsis.js

Ellipsis.js is a pure JavaScript library for responsive text truncation that enables you to truncate multi-line text within a specified DOM element(s) with ellipsis.

How to use it:

Link to the JavaScript file ‘ellipsis.js’:

<script src="ellipsis.js"></script>

Initialize the Ellipsis, specify the target container, and set the maximum lines of text to show after truncating.

Ellipsis({
  className: '.container',
  lines: 3
});

Set the line count in portrait orientation

Ellipsis({
  portrait: null, // default no change, put a number of lines if you want a different number of lines in portrait mode
});

Changelog:

08/11/2026

  • v2

You Might Be Interested In:


One thought on “Responsive Multi-line Text Truncating In Pure JavaScript – Ellipsis.js

Leave a Reply