开发者

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

<div id="id_div_comments"><p>body4qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq开发者_Go百科qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq</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 ?


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

#id_div_comments p{
 word-wrap:break-word;
}


Try this code:

#id_div_comments p{
 white-space:normal;
}


The accepted answer doesn't work for me

After seaching around, the following css actually works

#id_div_comments p{
 overflow: hidden;
}

Just trust me

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


Old question but no correct answer, for long text this should work

#id_div_comments p{
 word-break: break-all;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜