Krzysztof Majewski
Krzysztof Majewski

Reputation: 2534

Break text into three lines with overflow

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?

Upvotes: 0

Views: 724

Answers (2)

dhaval raythatha
dhaval raythatha

Reputation: 84

Html Code:

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

Css Code:

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

Jsfiddle:-

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

Upvotes: 1

Denny Sutedja
Denny Sutedja

Reputation: 538

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>

Upvotes: 1

Related Questions