/    Sign up×
Community /Pin to ProfileBookmark

How do I keep a form from making my table bigger?

I don’t really understand forms, but it seems to add some extra pointless space under the actual form. I attached a picture of my table with the form, and without it.

Anyone know how to get it so with the form the table stays the size of how it is without the form? What is causing that extra space and how do I get rid of it?

Here is the table code…

[CODE]<table width=’100%’ cellpadding=’0′ border=’0′ cellspacing=’0′>
<tr valign=’center’>
<td align=’left’ valign=’center’>
STUFF IN HERE
</td></tr></table>
[/CODE]

And here is the form code…

[CODE]<form method=”post”>
<select id=’postboxsmall’ name=”boardlevel” onchange=”jump(this.form)” >
<option></option>

<?php
$x = -1;

while ($x >= $topuserlevel)
{
$topstringtopass = “boardlevelcheck.php?boardlevel=” . $x;
?><option value='<?php echo $topstringtopass; ?>’ target=”_self” <?php if ($x == $_SESSION[‘boardlevel’]) { ?>selected<?php } ?>><?php echo $x; ?></option><?php
$x = $x-1;
}
?>
</form>[/CODE]

HALP!

[upl-file uuid=dfc799ee-c503-46d8-aec4-d25387a3e976 size=29kB]menubarimage.png[/upl-file]

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@xvszeroauthorMay 06.2008 — Hmm, I seem to have solved it myself by just putting the form tags outside the <td> </td>

I have no idea WHY that solves it, but hey, it works.
Copy linkTweet thisAlerts:
@CabenMay 06.2008 — Putting the form tag within a table or tr tag (but outside of a td tag) is how I originally solved this problem myself, but I later found out that unfortunately it's not valid HTML.

The main problem with the form tag is that, for some unknown reason, it has a margin associated with it. The best way to handle this that I've found is to use CSS to remove the margin. You can do this either on a form-by-form basis, ie:

<form style="margin: 0px;"><!-- form elements --></form>

Or you can use it for all forms on the page, ie:

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

Either way should fix the problem you're having and also validate as proper HTML. Good luck!
Copy linkTweet thisAlerts:
@AmolMay 07.2008 — Actually, the <form> tag takes the default margin and padding itself.

Do the following:

[COLOR="Blue"]<form style="margin:0px; padding:0px;">

</form>

[/COLOR]


...this will resolve your issue.

[B][COLOR="Blue"]Amol NW[/COLOR][/B]
×

Success!

Help @xvszero spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...