[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 558
  • Last Modified:

form tag adds blank line in IE

I have two tables on a page. Between the two tables I define a <form>. On IE it inserts a blank line when I define a form. On firefox and safari it does not. Is there any way to make IE not do this? Short of that, can I tell (in jsp) what kind of browser has connected?
<html>
<body>
<table cellspacing=0 border=1 bordercolor=red><tr><td>table1</td></tr></table>
<form name=joe method=post>
<input type=hidden value=joe>
<table cellspacing=0 border=1 bordercolor=blue><tr><td>table2</td></tr></table>
</form>
</body>
</html>

Open in new window

0
jmarkfoley
Asked:
jmarkfoley
1 Solution
 
erikTsomikSystem Architect, CF programmer Commented:
try this
<html>
<head></head>
<body>
<table cellspacing="0" border="1" bordercolor="red"><tr><td>table1</td></tr></table>
<form name=joe method=post>
<input type=hidden value=joe>
</form>
<table cellspacing="0" border="1" bordercolor="blue"><tr><td>table2</td></tr></table>

</body>
</html>
Let me know if this fix the problem?
0
 
erikTsomikSystem Architect, CF programmer Commented:
the form itself add blank . So you can put higher or lower of your code
like this
<html>
<head></head>
<body>
<table cellspacing="0" border="1" bordercolor="red"><tr><td>table1</td></tr></table>
<table cellspacing="0" border="1" bordercolor="blue"><tr><td>table2</td></tr></table>
<form name=joe method=post>
<input type=hidden value=joe>
</form>

</body>
</html>
0
 
Seven priceFull StackCommented:
that is correct you can use the one form for all you postback validations. if you surround the input type within the form tag no matter where is it on the page. It will still return.

Not a form with runat server is a whole different method.

<form name=joe method=post ID="Form1">
<table cellspacing=0 border=1 bordercolor=red ID="Table2"><tr><td>table1</td></tr></table>
 
<input type=hidden value=joe ID="Hidden1" NAME="Hidden1">
<table cellspacing=0 border=1 bordercolor=blue ID="Table3"><tr><td>table2</td></tr></table>
</form>

Open in new window

0
 
itzyCommented:
To prevent extra spacing below a form, it is sufficient to set the bottom margin to zero:
<form style="margin-bottom: 0" ...>
You could also set margin to zero, this will set the margin on each or the 4 sides to zero:
<form style="margin: 0" ...>
0
 
jmarkfoleyAuthor Commented:
Moving the tables to either side of the form isn't practical since the real table contains form elements. I probably should have shown that in my example.

setting the margins to zero did the trick. In my case, setting the bottom margin didn't work, but setting the top margin did. So, I just created a class for form in the global css file with margin: 0. That *should* be I.E. default like it obviously is in safari

Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now