Truncate text to lines, not number of characters
trunk8 is a JS library that helps truncate text to a specific number of lines, not characters.
$('#t8-lines').trunk8({
lines: 2
});
In the end we'll have something like:

The library also provides features like custome fill</code>, update</code>, etc.
Written by Tu Hoang
Related protips
1 Response
Solid. Very solid. This will make frontend dev work much easier for the designer's eyes looking over my shoulder. Couple this with the proper character fall back, and it's a daggom fine tool. Thanks for sharing.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#