在網上找了有很多解決該問題的方法:
<div>
<div style="float:left;">111111111</div>
<div style="float:right;">22222222</div>
<div style="clear:both;"></div>
</div>
解決方法2:
<div style="overflow:auto;">
<div style="float:left;">1111111111</div>
<div style="float:right;">2222222222</div>
</div>
上述兩個方法并沒有成功,可能是我的情況不同。
下述的方法成功了,現記錄如下:
設置DIV需要三個參數:
height:高度;
min-height:最小高度(只針對火狐,IE不識別該標簽)
!important:重要,提前;(當該標簽出現在同一選擇器里時,火狐優先執行,而IE默認執行最后一 個屬性)
需要注意的是:在針對一個需要定高度,同時又希望能高度隨內容的變化自適應的話,寫發的順序要注意;下面是正確的定義順序;
height:auto !important;
min-height:89px;
height:90px;
<div>
<div style="float:left;">111111111</div>
<div style="float:right;">22222222</div>
<div style="clear:both;"></div>
</div>
解決方法2:
<div style="overflow:auto;">
<div style="float:left;">1111111111</div>
<div style="float:right;">2222222222</div>
</div>
上述兩個方法并沒有成功,可能是我的情況不同。
下述的方法成功了,現記錄如下:
設置DIV需要三個參數:
height:高度;
min-height:最小高度(只針對火狐,IE不識別該標簽)
!important:重要,提前;(當該標簽出現在同一選擇器里時,火狐優先執行,而IE默認執行最后一 個屬性)
需要注意的是:在針對一個需要定高度,同時又希望能高度隨內容的變化自適應的話,寫發的順序要注意;下面是正確的定義順序;
height:auto !important;
min-height:89px;
height:90px;