header
 
     
 
pixel
pixel pixel

Remove vertical space after HTML form

HTML forms have a nasty habit of adding extra vertical space after the end of the form (eg - after the tag). This can cause problems when you have your form in a table. A way to remove the vertical space that works in most browsers (but not Netscape 4) is to define the margin-bottom:
<form method="post" action="search.php" style="margin-bottom:0;">

Unhelpful Helpful Rating 4.1 (score out of 5, no. of ratings: 47)
Comments
Comment by MrBlaQ on 2005-03-03
Wow, that totally worked! Thanks a lot!

Comment by Heather O'Hara on 2005-03-10
you've saved my life!

Comment by ShamzZ on 2005-04-21
excellent little tip, that has always bugged me...

Comment by Newbie on 2005-08-03
Excellent! problem solved :)

Comment by miko on 2005-08-11
Works with one form but don't work if you have several forms:

-->vertical space between forms!!

Comment by joel on 2005-08-12
i have run into this problem several times but always got around it without really fixing it. No with this solution it really fixed. Thanks Joel

Comment by Rob on 2005-08-29
This should go in your style sheet, if you are serious about your site design, you should get familiar with .css

Comment by Billy on 2005-12-28
nice

Comment by Thanks on 2008-06-12
you are a genius :)

Comment by unfettered on 2007-11-02
Thanks a lot.. saved me a lot of trouble.

Post a Comment
Name
Email
(optional)
Comment
RatingUnhelpful Helpful
Security Image* (this is just to prevent spam submissions)
Security Image