2012-04-20 65 views
0

HTML:形式的文本输入错位

<form action="search.php" method="GET"> 
    <input type="text" name="q" value="Search for an item..." width="150" style="border: solid 1px black; padding: 3px;" /> 
    <input type="image" src="images/search_icon.png" style="width: 24px; height="30px;" /> 
</form> 

我得到什么:

enter image description here

由如果我尝试在按钮上使用填充,它会将整个表单向下移动。

+0

您有一个额外的'“'在'style'属性的中间。 – Aaron 2012-04-20 16:07:45

+0

哦,是的,改变了它,但仍按钮在同一个地方。 – shakethefloor 2012-04-20 16:17:44

+0

什么是你的问题? – Madbreaks 2012-04-20 16:23:39

回答

1

尝试设置中间输入的垂直对齐属性。

input { 
    vertical-align: middle; 
} 

jsFiddle example

+0

几乎在那里... http://i43.tinypic.com/orjdol.png – shakethefloor 2012-04-20 16:49:18

+0

什么是您的图像的链接? – j08691 2012-04-20 16:50:19

+0

http://goo.gl/QABB5 – shakethefloor 2012-04-20 16:53:10