Vertically center text in text input in Internet Explorer

I am having trouble vertical aligning text in an input field in Internet Explorer.

I have:

input#search {

In Firefox and Chrome, it seems to be automatically vertical aligned, however in Internet Explorer it is not.


Just set the height and line-height for the input object and it works fine (ie 7+).

input { border: 0; font-size: 0.8em; height: 32px; line-height: 32px;}

gl Paulo Bueno

Just define line-height and height for a text box with same value. It will be taken care

You can use IE conditional comment like this:

<!--[if IE]>
  padding-top:3px;    /* adjust value */

Setting line-height:1 might mitigate the vertical alignment and a bit of padding:.15em should add some breathing space to the fields too.

Check the parent div. If it's empty you need to add content (&nbps;) so explorer will calc the height correctly.

Need Your Help

How to rotate a Three.js Vector3 around an axis?

javascript vector rotation three.js

How to rotate a Three.js Vector3 by a certain angle around an axis?