{"id":270051,"date":"2018-04-27T06:53:04","date_gmt":"2018-04-27T13:53:04","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=270051"},"modified":"2019-08-17T19:19:38","modified_gmt":"2019-08-18T02:19:38","slug":"line-clamp","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/l\/line-clamp\/","title":{"rendered":"line-clamp"},"content":{"rendered":"

The line-clamp<\/code> property truncates text at a specific number of lines.<\/p>\n

The spec for it is currently an Editor’s Draft, so that means nothing here is set in stone because it’s a work in progress. That said, it’s defined as a shorthand for max-lines<\/code> and block-overflow<\/code>, the former of which is noted as at risk of being dropped in the Candidate Recommendation.<\/p>\n

<\/p>\n

It’s easy to see how max-lines<\/code> would be nixed since it’s function (setting the number of lines before truncating) is already baked into line-clamp<\/code> and any further abstraction might be unnecessary. But that’s getting us off track, so let’s move on.<\/p>\n

Syntax<\/h3>\n
.module {\r\n  line-clamp: [none | <integer>];\r\n}<\/code><\/pre>\n

line-clamp<\/code> accepts the following values in the current draft of the spec:<\/p>\n