float父元素关于指定clear属性的看法

来源:互联网 发布:js倒计时60秒页面显示 编辑:程序博客网 时间:2024/06/06 09:03

本人在很多网页中看到float父元素不能指定其clear属性,今天着手试验了一下,发现那是个错误的说法,不知道是不是我代码写的不对还是怎样,如果有其他看法,欢迎大家补充哈:

<DIV style="height:200px; clear:both;">
<div style="float:left; width:30%; height:100%; background:#00FF00; margin:10px;"></div>
<div style=" float:left;width:30%; height:100%; background:#0f0F52;"></div>
<div style="float:right;width:25%; height:100%; background:#ffFF00;"></div>
</DIV>

看清楚哦,我给父元素指定clear,并对float元素自己添加margin属性,都没有错哦,大家有时间可以验证下,并给出自己的看法哈,免得新人一错再错呢

原创粉丝点击