
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








for multiline truncations i recommend using the lightweight javascript plugin cuttr.js (https://www.npmjs.com/package/cuttr) for this. there are also options for word and sentence truncation.