DEV Community

Cover image for Truncating multiline text with line-clamp
SnippFlow
SnippFlow

Posted on • Edited on

Truncating multiline text with line-clamp

line-clamp is a CSS property that allows you to truncating multiline text (cut off text) within an HTML element to a certain number of lines. It’s perfect for when you want to show only a part of long text, like titles, product descriptions or article excerpts, while keeping readability and looks.

See the following Codepen for a demo:

Full article: Truncating multiline text with line-clamp
CSS Snippets

Top comments (0)