HTML/Answer Detail

How to truncate the long text using css?

Priya
Priya
Member
40 Points
20 Posts

Hi ,

I have a div with some text. I want the text not exceed the new line.  I want to do this using css.

Is there any way to do so through css?

Total Answered: 2
Total Marked As Answer: 0
Posted On: 05-May-2018 02:13
Share:   fb twitter linkedin
Use Ellipsis in the text-orverflow=> text-overflow: ellipsis
 - Brian  05-May-2018 02:18
Answers
Smith
Smith
276 Points
93 Posts
 
 
Posted On: 05-May-2018 02:21

Use following css class

.truncate {
  width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

As

<div class="truncate"> Some long text. Some long text. Some long text. Some long text </div>
andro
andro
10 Points
5 Posts
 
 
Posted On: 08-May-2018 20:15
.truncate {
  width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

Blog

Active User (2)

 Log In to Chat