70

How can I show three dots(...) in a text like this? like this?

Jonathan Ivgi
  • 777
  • 1
  • 5
  • 10

1 Answers1

168

Add all these. To make in single line.

{
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    width:100px; /* some width */
}

To do in multi line which actually you asked.

#content {
    overflow: hidden;
    width:100px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

working fiddle: https://jsfiddle.net/mishrarajesh/676jc7sa/

Please note that this multiline code is supported only in web-kit browsers for now.

Jakub Kurdziel
  • 3,216
  • 2
  • 12
  • 22
rajesh
  • 2,354
  • 1
  • 12
  • 15