How to set the cursor position to the upper left edge of the input

Suppose I have an input field, for example the following:

enter image description here

How to set the cursor in the upper left part of this input field?

+4
source share
4 answers

This should work

input {
   padding-top: 0;
   padding-left: 0;
   line-height: 1em; // this probably doesn't matter
}

It seems that you probably have an add-on like 40px 0or something like that. Thus, the top and bottom have a lot of space (indentation) above and below.

EDIT:

If this does not work, you probably have a set heightfor your input, which is bad. Because the input is for one line only. If you want to use multiple lines, you should use tags <textarea></textarea>instead<input>

<textarea>, - , ,

http://jsfiddle.net/PVRp4/

input {
    padding: 0 0 400px 0;
}
+9

AFAIR , , . .

+1

Textarea ? <textarea></textarea>. PLS... <textarea></textarea> <input></input>.

css text-align: center - , . f12 .

+1

The simple solution for me was in the HTML for my ASP: TextBox was at the end of my bookmark tag: "... TextMode =" MultiLine "/">, as shown below:

 <asp:TextBox ID="txtPermissionSearch" runat="server" Width="150px" Height ="150px" TextMode="MultiLine" />
+1
source

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


All Articles