外层DIV在Firefox里不会自动伸展高度的解决方法

IE中div的高度会根据内容来自伸展适应高度。但是FIrefox不会。

解决方法1:
<div>
    <div style=”float:left;”>111111111</div>
    <div style=”float:right;”>22222222</div>
    <div style=”clear:both;”></div>
</div>
方法1应该是最佳的了

解决方法2:
<div style=”overflow:auto;” >
    <div style=”float:left;”>1111111111</div>
    <div style=”float:right;”>2222222222</div>
</div>
方法2在IE下有可能现滚动条,是DIV的滚动条,不是浏览器滚动条

解决方法3:
<!–[if !IE]><!–>
<link href=”css/firefox.css” type=”text/css” rel=”stylesheet” />
<!–<![endif]–>

解决方法4:
<div style=”display:table” >
    <div style=”float:left;”>1111111111</div>
    <div style=”float:right;”>2222222222</div>
</div>
注意:方法4在FF里有时出现右列下沉的情况,不建议使用

你可能感兴趣的:(浏览器,IE,div,firefox,float,stylesheet)