Reputation: 4450
Hey I have following html for a comment section:
{% for comment in comments %}
<br>
<div class="container">
<div class="row">
<div class="col-sm-5">
<div class="panel panel-default">
<div class="panel-heading">
<strong>{{ comment.author.username }}</strong>
<div class="text-muted">commented on: {{ comment.created|date:"Y/m/d" }}</div>
</div>
<div class="panel-body">
{{ comment.content }}
</div>
</div>
</div>
</div>
</div>
{% endfor %}
When I have text that is too long it just overflows at the moment like this.
How can I force line breaks when the text is too long for the comment box?
Upvotes: 0
Views: 610
Reputation: 1323
use this in yours style
.panel-body
{
word-break: break-all;
}
Upvotes: 1
Reputation: 9739
You can do this:
CSS
.break-word {
word-wrap: break-word;
}
HTML
{% for comment in comments %}
<br>
<div class="container">
<div class="row">
<div class="col-sm-5">
<div class="panel panel-default">
<div class="panel-heading">
<strong>{{ comment.author.username }}</strong>
<div class="text-muted">commented on: {{ comment.created|date:"Y/m/d" }}</div>
</div>
<div class="panel-body">
<p class="break-word">{{ comment.content }}</p>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
Upvotes: 1