clear:both 的作用
来源:互联网 发布:淘宝店铺介绍怎么写啊 编辑:程序博客网 时间:2024/04/28 09:34
如:
<div style="border:2px solid red;">
</div>
你可以将此部分代码放到一个HTML页面看看效果,然后在去掉”<div style="clear:both;"></div>”看一下效果,就知道这句话的作用了。
如图:
(1)有clear:both的:
(2)无clear:both的
这样看,应该就一目了然了:原来后边的Clear:both;其实就是利用清除浮动来把外层的div撑开,所以有时候,我们在将内部div都设置成浮动之。可以采用通过Hack实现:
<style>
}
<div class="clearfix" style="border: 2px solid red;">
</div>
里边的原理:
(1)、首先是利用:after这个伪类来兼容FF、Chrome等支持标准的浏览器。
:after伪类IE不支持,它用来和content属性一起使用设置在对象后的内容,例如:
a:after{content:"(link)";}
这个CSS将会让a标签内的文本后边加上link文本文字。
(2)、利用“* html”这个只有IE6认识的选择符,设置缩放属性“zoom: 1;”实现兼容IE6。
(3)、利用“*:first-child + html”这个只有IE7认识的选择符,设置缩放属性“zoom: 1;”实现兼容IE7。
- clear:both 的作用
- clear:both 的作用
- DIV+CSS中clear:both的作用
- CSS 的 clear:both;
- Clear both 的妙用
- clear:both的认知
- clear:both的理解
- clear:both的理解
- clear:both的理解
- clear:both的理解
- clear:both的理解
- clear both 的用法
- clear:both的理解
- clear:both的用法
- clear:both 的妙用
- 小程序开发中clear:both对float的作用
- clear:both 的使用
- clear:both
- hdu 2196 (通过树的直径来求的方法)
- hdu1856 More is better
- 黑马程序员---高新-注解和泛型
- eclipse的快捷键
- 搜索问题
- clear:both 的作用
- win7 : Apache-2.4.4 + tomcat-7.0.41 集群的配置
- 下载那个drcom拨号器的记得用chmod修改权限
- Ubuntu find files
- POJ 1185 炮兵阵地 状态压缩dp
- Guava
- geohash:用字符串实现附近地点搜索
- pxssh报错,timeout
- 插入排序 insertion sort