Question

I want to show data in textarea from database. But I have facing a problem. I cant align that text in left.All time it shows data in center. Please help me.

My code :

<span>
   <textarea disabled class="text-left" style="width:510px;max-height:200px;overflow-y:auto;text-align:left;" id="textareaMessage">{{sentMessage.message}}</textarea>
<span>
Was it helpful?

Solution

Here is no issue in your CSS because if you enter hard-coded value instead of {{sentMessage.message}}, text automatically comes to left. So please check the database entries which are coming to that text area are properly formatted or there itself any blank spaces present.

OTHER TIPS

This is a known issue when using templating languages sometimes.....Try put everything on its own lines....that sometimes fixes it.

If you're having the problem I think youre having... (I have this issue when using Jeditable...whenever I pull data from the database, its got massive padding.....and to get rid of it, putting the variable on its own line, magically fixes the issue.....Dont really understand why....but it does) :)

<span>
 <textarea disabled class="text-left" style="width:510px;max-height:200px;overflow-y:auto;text-align:left;" id="textareaMessage">
     {{sentMessage.message}}
 </textarea>
 <span>

And if thats not your problem then try..

text-align:left!important;

In your CSS

@Html.TextAreaFor(model => model.Name, new { @class = "form-control", style = "width: 1000px; height: 34px; margin:0 auto", @placeholder = "margin:0 auto work perfect" })

Actually the text is aligned left in the Textarea but with the identation. It seems like the text is not aligned left. By putting everything on the same line, you avoid this problem.

Hope the explanation is clear ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top