Incorrect vertical alignment in IE8

JMan picture JMan · Oct 8, 2010 · Viewed 27.8k times · Source

The default text in my search box looks fine in Chrome, FF, and Safari (vertical-align: middle).

However, the default text rises to the top of the search box in IE 8.

Is there a workaround for IE? Thanks for your help.

HTML:

<input type="text" class="text" value="Search" title="Search" />

CSS:

.text {
    height: 47px;
    font-size: 18px;
    margin: 0; 
    padding: 0 5px 0 45px;
}

Answer

Stuart Burrows picture Stuart Burrows · Oct 9, 2010

Have you tried setting the line height to match the height of the text box? The text should automatically appear in the middle of the line