How to supress the automatic space between FORMs

If you stack forms on top of each other on an HTML page, you will notice that there is an automatic blank space inserted. This code will eliminate that space which will give you more freedom when designing a page with many separate forms.

<html>
<head>
   <title>form test</title>
   <style>
   form {margin-top: -1em;}
   </style>
</head>
<body>
<form method="POST" action="xxx">
Search here: <input type="text">
<input type="submit" value="search" name="B1">
</form>
<form method="POST" action="xxx">
Search there: <input type="text">
<input type="submit" value="search" name="B1">
</form>
</body>
</html>

You might also like...

Comments

Edward Tanguay Edward Tanguay updates his personal web site tanguay.info weekly with code, links, quotes and thoughts on web development. Sign up for the free newsletter.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Beware of bugs in the above code; I have only proved it correct, not tried it.” - Donald Knuth