Forms without ugly whitespace

They have: 112 posts

Joined: Aug 2001

I have always struggled with a little html quirk when it comes to forms. I have several pages with small forms within them such as login boxes and subscription boxes. It's easy to put them in a page but I always find that there is this ugly whitespace above and below the form and I can't get rid of it !!!. How can I display these forms without the line breaks that form tags seem to automatically insert ??

He has: 1,016 posts

Joined: May 2002

Add this CSS code to your code....

<style type="text/css">
<!--
form {
margin: 0px;
padding: 0px;
}
-->
</style>
'

Busy's picture

He has: 6,151 posts

Joined: May 2001

also depends where they are, ie tables, divs ...
If its simple table you can do something like

...

to validate in xhtml you need a div or something between the form tags as well

...

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

You need DIVs in form tags for it to validate as XHTML? what for?

Busy's picture

He has: 6,151 posts

Joined: May 2001

Quote: Originally posted by Renegade
You need DIVs in form tags for it to validate as XHTML? what for?

to make it validate Wink just one of the many stupid things you have to do these days. a blank (empty) div is all you need.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Actually (*ahem*) the point is to give the elements within a form structure, so the div is supposed to go AROUND them. If you use accessible forms, you will also use fieldset, and legend, and other fun elements. The form requires more intricate markup because of its function.

Busy's picture

He has: 6,151 posts

Joined: May 2001

problem is some of the accessible form propertys aren't supported (silly oprea) while others only either support half of it or have their own method of supporting it.

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

...man that sucks...

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

ah yes, welcome to 2003, where we have to admit that Jakob Nielsen was right. Bugger!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.