0

Let's say I have this text:

"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

And I want to display it with specified width and line count(3) like that:

aaaaaaaa
aaaaaaaa
aaaaa...

How can I achieve this?

Krzysztof Majewski
  • 2,494
  • 4
  • 27
  • 51

2 Answers2

1

css:

<style>
p.text {
/* your costume with & height*/
    width: 11em;
    max-height: 3.6em;
    line-height: 1.8em;
    border: 1px solid #000000;
    word-wrap: break-word;

}
</style>
Denny Sutedja
  • 538
  • 4
  • 15
1

Html Code:

<div class="parent">  
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabdbdbdfbdbdbdfbdbdsb
</div>

Css Code:

.parent{width:100px;word-break:break-all;}

Jsfiddle:-

https://jsfiddle.net/Dhavalr/apzy68vp/1/