Html - How can I align input text and search button? Stack Overflow

How can I align input text and search button?


I am experiencing a very weird bug (I think), something is making the button about 2px lower that the search box. Can anyone tell me how I could fix this issue please?




2 Answers 2


You could use box-sizing: border-box; to get the real height that you set.


Set vertical-align: top; to make them to align to the top.


Decrease text input font-size , it seems 20px is too large and make the box to grow taller.


Errors need to fix:



  • Don't forget to add a doctype .

  • It's missing tag.

  • Also missing tag.

  • The unopened .

  • is self-closing tag, do not use .


Comments