Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form tag adds line break 1

Status
Not open for further replies.

eljacobs

Programmer
Oct 13, 2003
47
0
0
GB
Hi

I have noticed that when i add a form to my page a line break is added to the page. There is no <br> or <p> tag but the line break appears in my page when displayed in a browser and it affects my page layout if there is another table/image etc directly below the form.

One thing that seems to work is if i move the <form> and </form> tags inside the structure of the table (see below) rather than nesting the table within the form tags.

Code:
<table width="250" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td width="60" height="51">&nbsp;</td>
            <td colspan="2">&nbsp;</td>
            <td width="13">&nbsp;</td>
          </tr>
          <tr> 
            <td height="30">&nbsp;</td><form action="mailinglist.asp" method="get" name="ml" id="ml">
            <td colspan="2"><input name="ml_name" type="text" class="mailinglist" id="ml_name3"></td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td height="31">&nbsp;</td>
            <td colspan="2"><input name="ml_email" type="text" class="mailinglist"></td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td height="25">&nbsp;</td>
            <td width="87" align="left"><input type="image" name="submit" src="images/spacer.gif" width="25" height="25" border="0" alt="Submit"> 
            </td></form>
            <td width="90" align="right" valign="top"><a href="mailinglist.asp"><img src="images/spacer.gif" width="70" height="25" border="0"></a></td>
            <td>&nbsp;</td>
          </tr>
        </table>

This displays ok and the form works but i am worried about the results in browsers other than IE6.

Can anyone offer some advice?

Thanks
 
<form> is a block element, like <p> or <table> or <h1>, etc. If you want to change the amount of whitespace around that block, then follow Tony's advice and set the margin with CSS.

If you don't want a line break at all, you can do this:
Code:
<form style="display: inline;"...
Of course, in practice, you'd be better putting that CSS into an external style sheet.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top