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)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay