在DIV里面打破的话

时间:2014-02-26 23:07:39

标签: html css

我就像这个人https://stackoverflow.com/questions/20430641/word-break-issue-in-css

我正在经历他所说的一切,我也尝试了各种各样的事情,但遗憾的是没有任何帮助。

这个问题没有一个有用的答案。所以,我再次发布它。

我正在使用codeigniter,这就是我回应我的段落的方式:

<div class="review-content">

  <p><?php echo $review->content ; ?></p>

</div>

输出结果如下:

 A very clean hotel with a great st
 aff and very helpful. The restaura
 nt is classic but the food is very

2 个答案:

答案 0 :(得分:2)

尝试使用word-wrap属性。将其设置为word-wrap:break-word应该是您正在寻找的。

有关详细信息,请the MDN entry

答案 1 :(得分:2)

您需要使用word-break

div {
    width: 210px;
    word-break: break-all; /* this is probably set somewhere in your code */
    background: #f5f5f5;
}

div.no-break {
    word-break: normal;
}

Demo

相关问题