2010-10-13 115 views
0

我在兩個div之間有一個奇怪的問題,頂部div下面有一個空格,只顯示在IE8中。儘管我在家裏使用IE8,但我沒有看到它,但是在其他地方我也是這樣。IE中兩個div之間的空格

圖片在IE(紅色是不應該存在的空間): In IE

在Firefox和其他瀏覽器它顯示優良,如下所示: In FF

<div id="top"> 

<form action="" onsubmit=""> 

    <table > 

    <tr> 

    <td> 
    Name<input type="text" /> 
    </td> 


    <td> 
    Password<input type="password" />    
    </td> 

    <td> 

    </td>    

    </tr> 


    </table> 

    </form> 

</div> 

    <div id="header"> 

    </div> 


#top 
{ 
    margin-right: auto; 
    margin-left: auto; 
    margin-top: 0px; 
    background-color: #000000; 
    top: 0px; 
    text-align: center; 
    font-size: 16px; 
} 
#header 
{ 
    width: 100%; 
    height: 100px; 
    background-color: #336699; 
    margin: 0px; 
    padding: 0px; 
} 

我有試圖浮動兩個div的,但我似乎無法得到它的工作。

有什麼建議嗎?由於

+0

您是否嘗試過設置margin-bottom:0;在上面? – JohnFx 2010-10-13 15:44:37

+0

是的,已經試過了,謝謝。 – Elliott 2010-10-13 15:46:02

回答

2

將所有表單元素的邊距爲0px:

form 
{ 
    margin: 0px; 
} 
+0

完美,謝謝。 – Elliott 2010-10-13 16:32:26

0

變化的div的保證金爲0px,看看它的工作原理。