2011-01-20 53 views
0

我有ie7問題。在Firefox和IE8中,一切似乎都能正常工作。ie7按下花車

在ie7中,第一個元素正常工作,但其他所有元素都按下,就像他們有明確的應用。

圖片描述了這一點。

alt text

下面的代碼。

.newLabellg 
{ 
    float:left; 
    width:66px; 
    margin:3px 0 0 0; 
    font-weight:bold; 
    color:#000; 
} 


<div style="float:left; width:320px;"> 

    <div style="margin-bottom:10px; float:left;"> 
     <div class="newLabellg">Cusotmer#:</div> 
     <div style="float:left;"> 
     <asp:TextBox ID="CustomerNumber" runat="server" Width="220px"></asp:TextBox> 
     </div> 
    </div> 

    <div style="margin-bottom:10px; float:left; clear:both;"> 
     <div class="newLabellg">Cusotmer:</div> 
     <div style="float:left;"> 
     <asp:TextBox ID="CustomerName" runat="server" Width="220px"></asp:TextBox> 
     </div> 
    </div> 

    <div style="margin-bottom:10px; float:left; clear:both;"> 
     <div class="newLabellg" style="float:left;">Address:</div> 
     <div style="float:left;"> 
     <asp:TextBox ID="Address" runat="server" Width="220px"></asp:TextBox> 
     </div> 
    </div> 

    <div style="margin-bottom:10px; float:left; clear:both;"> 
     <div class="newLabellg">Mailing Address:</div> 
     <asp:TextBox ID="Address2" runat="server" Width="220px"></asp:TextBox> 
     <div style="float:left; margin:3px 0 0 0"> 
     <asp:DropDownList ID="City" runat="server" Width="109px"> 
     </asp:DropDownList> 
     <asp:DropDownList ID="Province" runat="server" Width="109px"> 
     </asp:DropDownList></div> 

    </div> 
</div> 

任何想法爲什麼/什麼ie7在做什麼,我該如何解決它?

回答

2

單純從每個實例刪除clear: both

<div style="margin-bottom:10px; float:left; clear:both;"> 

使得它在我測試了它的瀏覽器看起來是正確的:IE7/8 + Firefox瀏覽器。

如果刪除clear: both會導致不同的問題,請告訴我們,我們可以找到解決方法。

+0

我會試試這個並且回覆你。但我很清楚。明確:兩者都只適用於該要素而不適用於其子女?這實際上是一個ie7錯誤,對吧? – Adam 2011-01-20 23:14:09

1

我想說的是,唯一合乎邏輯的結論是clear:both導致了問題 - 因爲它是第一個項目沒有的唯一樣式。

float + clear對同一元素造成IE7內出現異常異常。

http://www.brunildo.org/test/IEWfc3.html