Textarea Centers The first line of text, and I want it to be left justified

I have a simple text area in the form, and for some reason, when I click on the text area to start typing it, it centers the first line. I can hit back until it stands at the beginning of the text box, but I don't know why it does it. I am Googled and cannot find the reason why he will do it. Here is my jsfiddle for this:

http://jsfiddle.net/4cVkn/

I tried text-align: left in many places (embedded HTML and CSS) and it doesn’t change anything. It seems like this should be a simple fix, thanks for the help.

+4
source share
2 answers

It is not centered, it just has a default value for a series of spaces.

Put </textarea> immediately after the start tag instead of filling it with a space.

+13
source

By default, the contents of a text area are the contents between its tags. Your source has something like:

  <textarea name="bio"> </textarea> 

therefore, the initial value of the text area is a new line and the spaces used for indentation are characters that you can overlap.

To get rid of them, close the tag immediately:

 <textarea name="bio"></textarea> 

In addition, the kind of layout of the form that you are going to use should probably be done using tables - at least until various shiny new CSS3 layouts are better supported. Your avoidance of them actually made the code less readable, which with all <br/> s.

+2
source

Source: https://habr.com/ru/post/1389931/


All Articles