我想保留我的段落,所以我将该代码放在pre
标签中,但之后我的话就破了。有没有解决这个问题的方法。我不想打破我的话,我也提供div
宽度。以下是我的代码:
<li class="list-group-item" ng-repeat = "answer in answers">
<span class="label label-default label-pill pull-xs-right " style="float: right">{{answer.UserID}}</span><br>
<pre style="font-family: helvetica;font-size: 14px;display: block;line-height: 20px;text-align: left "> {{answer.AnswerStr }} </pre>
</li>
答案 0 :(得分:0)
查看Chris Coyier的博文:Make "Pre" Text Wrap
简而言之,将其添加到CSS文件中:
/* Browser specific (not valid) styles to make preformatted text wrap */
pre {
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}