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: 1
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
Participant
332 Points
101 Posts
Marked as answer      

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>
Posted On: 05-May-2018 02:21
andro
andro
12 Points
6 Posts
     
.truncate {
  width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
Posted On: 08-May-2018 20:15

Blog

Active User (2)

 Log In to Chat