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>

What I get:

enter image description here

by the way, if I try use padding on just the button, it moves the whole form down.

3
  • You have an extra " in the middle of your style attribute. Commented Apr 20, 2012 at 16:07
  • oh yeah, changed it but the buttons still in the same place. Commented Apr 20, 2012 at 16:17
  • set a height attribute inside the styling of your input box. Commented Apr 20, 2012 at 16:27

1 Answer 1

1

Try setting the vertical-align property on the input to middle.

input {
    vertical-align: middle;
}

jsFiddle example.

Sign up to request clarification or add additional context in comments.

3 Comments

What's the link to your image?
Since your magnifying glass image has some extra white space on it, you'll need to position it and then adjust. See jsfiddle.net/j08691/wMYX4/2
This worked. Make sure that the elements' positions are relative

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.