Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the text cursor in a text field start a few px in?

I am wanting a text field that has a cursor that starts a few px (say maybe 4) in from the left-hand side. I know it can be done if you make the text field to size using padding, but I wanted to know if there is any way possible without using padding to resize the text box, but using the height and width CSS.

An ideas or input would be greatly appreciated.

like image 827
Scott Plunkett Avatar asked Jul 15 '12 03:07

Scott Plunkett


1 Answers

Use the text-indent property:

input {
  text-indent:20px;
}

You can also use padding with a fixed width. This will keep the width fixed at 100px but still do your padding.

input {
  padding-left: 10px;
  width: 100px;
}
like image 77
sachleen Avatar answered Sep 23 '22 20:09

sachleen