CSS fix for Graphical Input Submit Button Off-Set
So, you know how to use a graphic for your <input> submit button, right? Well, have you ever had trouble getting that graphical submit button to line-up with your <input> text field when both are side-by-side on the same horizontal line?

It can be a frustrating issue for any web standards advocate trying to bring a designers design to life … it should work, but why won’t it!? Playing with the margins and paddings don’t help and using absolute positioning just seems unnecessary. Well, thankfully the fix is easy and quick! Just give it a little class.
.submit { vertical-align: middle; *vertical-align: text-bottom; }
Simply give your <input> tag a class and within your CSS, assign that class’s “vertical-align” property. And like magic, all is right in the world.

This may be old news for many of the hard-core CSS nerds in the house — but I know this is an issue that plagues many front-end developers still. I was actually using the absolute position method up until a few months ago when Alex slapped this fix on me — who would have thought “vertical-align”!
Posted by Martin Ringlein on November 26, 2007 | Permanent Link |





I had this very problem and i was googling for an answer! now here it is!
Oh the power of Google! Glad it could help. I noticed a front-end developer struggling with it back at DC Start-up Weekend and thought the world needed to know!
I have this problem after a few days, thank u..
Glad this little post is helping … vertical-align is such an odd solution; not intuitive at all that it would be the fix.
Thank you thank you Thank you Thank you. You have no Idea how much annoyance this bug has caused me in the past.
I never even thought of using vertical-align on inputs. Thanks!
Nik and South Creative, very welcome.
Again, we don’t pretend to know everything about CSS (even though it feels like Alex and John do know it all at times). But, we saw something displaying wrong at default that didn’t make sense and we knew doing some trick hackery (like absolutely positioning the element relative to the form) was wrong, even if it worked and was quick.
Alex figured this one out a long time ago, but the issue plagues so many people still.
The best solutions are the simplest ones. Thanks a bunch.