开发者

Vertically center input field

I have a text input field on a page, however, I'm finding it difficult trying to vertically center the field in webkit (Chrome + Safari). It is fine in FireFox.

Here's the code:

<form action="/" method="get">
    <input type="text" name="s" id="search" class="search" size ="34" value="Search..." onblur="if(this.value == ''){ this.value = 'Search...'; this.style.color = '#BBB';}" onfocus="if(this.value == 'Search...'){ this.value = ''; this.style.color = '#000';}" />
    <input class="schbtn"ntype="submit" value="" />
</form>

And the开发者_StackOverflow社区 CSS:

.schbtn {background:url(/wp-content/themes/shamil/images/search_icon.png) no-repeat scroll 50% 50% #7BA60D;height:26px; width:26px;}
#navtabs li.rnavtab input{border:0;padding-left:5px;color:#BBB;}

These are the only two which affect it.

For those wanting to see this in action, visit, http://shamil.la, and observe the search field in both Firefox and Safari/Chrome. It's driving my head up the wall.

Thanks


Put a vertical-align:middle; on both of the input elements, and that will center it

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜