stackoverflow001
stackoverflow001

Reputation: 33

if not using padding, is there a way to get it?

enter image description here

if foucus the input text box. the cursor is on the top, i want to locate the cursor at the center part, if not using padding-top. how should i do?

Upvotes: 0

Views: 31

Answers (3)

Santosh Kori
Santosh Kori

Reputation: 371

You can use this

 input{
    height:      YOURIMAGE HEIGHT;
    line-height: YOURIMAGE HEIGHT; 
    display:block
 }

Upvotes: 0

Dipak
Dipak

Reputation: 12190

use this -

img{ vertical-align: middle; }

Demo

OR

Push the the input text element down by using -

input[type="text"]{
  margin: 4px 0 0 0;
}

Upvotes: 1

KaeruCT
KaeruCT

Reputation: 1645

You can try something like this:

#input-field {
   height: 20px;
   line-height: 20px;
}

This will center the text vertically on your input field, which should center the cursor as well.

Upvotes: 1

Related Questions