How to truncate the long text using css?

Priya
Priya
Participant
936 Points
28 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?

Views: 9656
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
None
2568 Points
74 Posts
         

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
Member
118 Points
3 Posts
         
.truncate {
  width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
Posted On: 08-May-2018 20:15
 Log In to Chat