-1

I have a large paragraph like: hello hi hello hi hello hello hi hello hi hi hello hi hello hi hello hi hello hi hello hi hello hi In this the paragraph i just want that if its length is more than the size of my box that i made in my webpage box than it should give such output: hello hi hello hi hello hello hi... Mean i want it to be written in at most one line. And if length of para is more that the width of the box then i want the output this way: hello hi hello hi hello hello hi... How to do this thing.

uditkumar01
  • 400
  • 5
  • 11
  • 1
    Have a look [here](https://css-tricks.com/snippets/css/truncate-string-with-ellipsis/) – Gerard Jul 01 '20 at 10:56
  • Does this answer your question? [Text-overflow CSS truncation](https://stackoverflow.com/questions/15292708/text-overflow-css-truncation) – Leogout Jul 01 '20 at 11:51

1 Answers1

1

This code will allow you to have maximum of two lines of text. The length of text you should manipulate by changing parents width.

.text {
   overflow: hidden;
   text-overflow: ellipsis;
   display: -webkit-box;
   -webkit-line-clamp: 2; /* number of lines to show */
   -webkit-box-orient: vertical;
}
Ognjen
  • 144
  • 8