Read more

josephschmitt/Clamp.js

Arne Hartherz
November 28, 2014Software engineer at makandra GmbH

Clamps (ie. cuts off) an HTML element's content by adding ellipsis to it if the content inside is too long.

While you can only truncate single lines with CSS by using text-overflow, this small JavaScript library also allows truncating text after multiple lines.

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

Please note:

  • For Internet Explorer, the element you clamp on needs to have its line-height set in pixels. A relative value will not work.
  • There is also the -webkit-line-clamp Show archive.org snapshot CSS property, but that won't work in Firefox let alone IE.
Posted by Arne Hartherz to makandra dev (2014-11-28 13:44)