Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 垂直居中输入字段_Html_Css_Center - Fatal编程技术网

Html 垂直居中输入字段

Html 垂直居中输入字段,html,css,center,Html,Css,Center,我在页面上有一个文本输入字段,但是,我发现在webkit(Chrome+Safari)中很难将该字段垂直居中。在FireFox中也可以 代码如下: <form action="/" method="get"> <input type="text" name="s" id="search" class="search" size ="34" value="Search..." onblur="if(this.value == ''){ this.value = 'Sear

我在页面上有一个文本输入字段,但是,我发现在webkit(Chrome+Safari)中很难将该字段垂直居中。在FireFox中也可以

代码如下:

<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>
这是唯一两个影响它的因素

对于那些想看到这一点的人,请访问并观察Firefox和Safari/Chrome中的搜索字段。它把我的头撞到墙上了


谢谢

垂直对齐:中间在两个输入元素上,这将使其居中

.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;}