How to truncate multiple line text using CSS ? (Adding ellipsis at the end of the text)

Prem Das
May 30, 2021

Let us suppose we want X lines of a text. Anything after that should be gracefully cut off and three dots(…) should get appended. This is called “Line Clamping”.

Imagine we have some HTML like this

And we want to limit it to exactly three lines in a container. Like this:

There are couple of ways to get this done. But we will discuss the simplest way.

Here, -webkit-line-clamp: 3 means we want to cut off the string after three lines.

Yeahhh, its that simple !!

Thank you for reading this article. Do not forget to give it a clap.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Prem Das
Prem Das

No responses yet

Write a response