2012-04-20 63 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