Results 1 to 2 of 2

Thread: <FORM> tage in IE vs FF & Other Browsers

  1. #1
    Join Date
    Oct 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default <FORM> tage in IE vs FF & Other Browsers

    I suspect this is either by design or a bug but i just thought it would be worth asking the question whether anyone knew a way around this slightly annoying problem.

    Take the code below as a simple example, there will be a 20-30px gap between the form and the bottom table when viewed in IE. It also doesnt matter what comes after the 1st form, as it seems anything that comes after the </FORM> tag will be shoved down the page by again approx 20-30px. This doesnt happed in FF and any of the other browsers. Just IE. Makes formating forms and tables for different browsers almost impossible.

    Code:
    <FORM NAME="form1" METHOD="post" ACTION="">
    <TABLE BORDER="1" CELLSPACING="0" CELLPADDING="0">
      <TR>
        <TD>&nbsp;</TD>
        <TD>&nbsp;</TD>
      </TR>
      <TR>
        <TD>&nbsp;</TD>
        <TD>&nbsp;</TD>
      </TR>
    </TABLE>
    </FORM> <------ gap appears here
    <TABLE BORDER="1" CELLSPACING="0" CELLPADDING="0">
      <TR>
        <TD>&nbsp;</TD>
        <TD>&nbsp;</TD>
      </TR>
      <TR>
        <TD>&nbsp;</TD>
        <TD>&nbsp;</TD>
      </TR>
    </TABLE>

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Spoons
    Take the code below as a simple example, there will be a 20-30px gap between the form and the bottom table when viewed in IE. It also doesnt matter what comes after the 1st form, as it seems anything that comes after the </FORM> tag will be shoved down the page by again approx 20-30px.
    With the code you posted, I see a gap in both IE and Fx (I didn't check elsewhere).

    The form element, like many block-level elements, has a bottom margin. This is what creates the gap. You can use a CSS declaration to remove it:

    Code:
    form {
      margin-bottom: 0;
    }
    Be aware that some elements have top margins, and other have both. Some may even have padding, and this can vary between browsers, too.

    If you want precise control over this sort of behaviour, you can remove both margin and padding on all elements, then selectively add it with other rules. For example:

    Code:
    * {
      margin: 0;
      padding: 0;
    }
    p {
      margin: 0.5em 0;
    }
    Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •