Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't break a long string/text, it exceeds the width of html div

Tags:

html

css

<div id="id_div_comments"><p>body4qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq</p></div><br/><br/>
</div>

The css file:

div#id_div_comments {
    width: 400px;
}

But the string/texts exceeds the division width. What can i do to break the texts when it reaches the width of the division ?

like image 495
shibly Avatar asked Nov 28 '22 04:11

shibly


2 Answers

wirte this in your css word-wrap:break-word; css:

#id_div_comments p{
 word-wrap:break-word;
}
like image 147
sandeep Avatar answered May 01 '23 15:05

sandeep


Try this code:

#id_div_comments p{
 white-space:normal;
}
like image 37
rajesh Avatar answered May 01 '23 16:05

rajesh