[英]Can't break a long string/text, it exceeds the width of html div
<div id="id_div_comments"><p>body4qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq</p></div><br/><br/>
</div>
The css file: css 文件:
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
word-wrap:break-word;
写入word-wrap:break-word;
css: css:
#id_div_comments p{
word-wrap:break-word;
}
Try this code:试试这个代码:
#id_div_comments p{
white-space:normal;
}
Old question but no correct answer, for long text this should work老问题但没有正确答案,对于长文本,这应该有效
#id_div_comments p{
word-break: break-all;
}
#id_div_comments p{
white-space:nowrap;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.