0

I have < p > tag and text there. Css:

p {
   max-height: 250px;
}

I want to make my text hide last word which can't fit in 250px of height and change it to "...". I have tried it:

p {
   white-space: nowrap;
   overflow: hidden;
   text-overflow: hidden;
}

It worked but not as I want. It hide word which can't fit in the first line, but not the the 250px of height. Is there anyway to do so? Thanx in advance.

Genjik
  • 320
  • 1
  • 7
  • 20
  • Possible duplicate of [CSS text-overflow: ellipsis; not working?](https://stackoverflow.com/questions/17779293/css-text-overflow-ellipsis-not-working) – Mark Oct 14 '17 at 00:49

2 Answers2

0

You need to use the overflow-y property to hide the y-axis.

More about overflow-y.

CSS

p {
  max-height: 250px;
  width: 100px;
  white-space: nowrap;
  overflow-y: hidden;
}

HTML

<p>Some text goes here</p>
DollarChills
  • 1,076
  • 1
  • 15
  • 33
0

Try this it will help sure

p{ 
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-height: 250px;
  width: 150px;
}
Harden Rahul
  • 930
  • 8
  • 15