+ -
当前位置:首页 → 问答吧 → css+div布局firefox和ie的不同表现

css+div布局firefox和ie的不同表现

时间:2011-03-23

来源:互联网

HTML code

<div style="height:500px; width:300px;" >
<div style="width:30%; height:50%; background-color:Green; float:left;"></div>

<div style="width:30%; height:50%; background-color:Red; float:left; clear:left;"></div>
<div style="width:70%; height:100%; background-color:Yellow; float:right;"></div>

</div>



这个当中IE下正常,firefox下布局错乱。。

HTML code

<div style="height:500px; width:300px;" >
<div style="width:30%; height:50%; background-color:Green; float:left;"></div>
<div style="width:70%; height:100%; background-color:Yellow; float:right;"></div>
<div style="width:30%; height:50%; background-color:Red; float:right;"></div>


</div>
这样的话两者都正常。。

请问情况1为什么firefox下不行呢?请指教!~谢谢~~



作者: littlecc2009   发布时间: 2011-03-23

<div style="height:500px; width:300px;" >
<div style="width:30%; height:50%; background-color:Green; float:left;"></div>
<div style="width:70%; height:100%; background-color:Yellow; float:right;"></div>
<div style="width:30%; height:50%; background-color:Red; float:left;clear:left;"></div>
</div>
里面三个div的嵌套顺序又问题,改成这样试试,应该可以了,也就是将第二个div和第三个颠倒一下

作者: intachi   发布时间: 2011-03-24