Reputation: 1541
I am developing a MVC app.
I have a commenting feature in the app.
My problem is, when any user posts a comments without pressing the enter key, then the comment comes out as one single line and crosses the screen and the user has to scroll horizontally to see the entire comment.
I want to wrap the comment and show it at a specific width.
Ex.
admin 04 May 13 12:43 PM zxczxcasdasdzxczxcasdasdzxczxcasdasdzxczxcasdasdzxczxcasdasdzxczxcasdasdzxczxcasdasdzxczxca
I use the below code to show the comments in the view
<div class="CommentP" style="width:550px;" >
@Html.DisplayFor(ModelItem => item.CommentText, new {style = "width:550px;" })
</div>
Upvotes: 4
Views: 16937
Reputation: 6861
Use <div style="word-wrap:break-word;">
or <div style="overflow:auto;">
Upvotes: 10